Format Nested JSON
Deep nesting is clearly visualized with proper indentation at each level.
Indent:
Switch tool:
Try:
Valid JSON
302 characters
Click nodes to toggle
{ "company": { "name": "Acme Corp", "departments": [ { "name": "Engineering", "teams": [ 2 items ] }, { "name": "Marketing", "teams": [ 1 items ] } ] }}How it works
- Paste your JSON — it validates and formats automatically
- Invalid JSON shows error details with line/column position
- Choose 2 or 4 space indentation
- Copy or download the formatted result
Code Examples
Here's how to achieve this in different programming languages:
1// Format JSON with 2-space indentation2const input = `{"company":{"name":"Acme Corp","departments":[{"name":"Engineering","teams":[{"name":"Frontend","members":[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]},{"name":"Backend","members":[{"id":3,"name":"Charlie"}]}]},{"name":"Marketing","teams":[{"name":"Content","members":[{"id":4,"name":"Diana"}]}]}]}}`;3const formatted = JSON.stringify(JSON.parse(input), null, 2);4console.log(formatted);56// Output:7// {8// "company": {9// "name": "Acme Corp",10// "departments": [11// {12// "name": "Engineering",13// "teams": [...]14// }15// ]16// }17// }
More JSON Examples
Format API Response
Format a typical REST API response with nested objects and arrays.
Format package.json
Format a Node.js package.json configuration file.
Format Config JSON
Format application configuration files with nested settings.
Format GraphQL Response
Format GraphQL API response data with complex structures.