Format GraphQL Response
Format GraphQL responses for easier debugging and data exploration.
Indent:
Switch tool:
Try:
Valid JSON
235 characters
Click nodes to toggle
{ "data": { "user": { "id": "123", "profile": { "name": "John", "avatar": "https://example.com/avatar.jpg" }, "posts": { "edges": [ 2 items ], "pageInfo": { 1 keys } } } }}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 = `{"data":{"user":{"id":"123","profile":{"name":"John","avatar":"https://example.com/avatar.jpg"},"posts":{"edges":[{"node":{"id":"p1","title":"First Post"}},{"node":{"id":"p2","title":"Second Post"}}],"pageInfo":{"hasNextPage":true}}}}}`;3const formatted = JSON.stringify(JSON.parse(input), null, 2);4console.log(formatted);56// Output:7// {8// "data": {9// "user": {10// "id": "123",11// "profile": {...},12// "posts": {...}13// }14// }15// }
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 Nested JSON
Format complex deeply nested JSON structures with multiple levels.