Prettify JSON

Format JSON with proper indentation for improved readability and debugging.

Code

Utilities
JSON.stringify(JSON.parse(jsonStr), null, indent);

Parameters

JSON string to format.

Number of spaces for indentation.

Browser·fetch() may be limited by CORS

More JavaScript Snippets