The JSON formatter that actually shows you what's inside
Most free JSON formatters online give you indented text in a monospace box. That's useful for basic formatting, but it doesn't help you understand the structure of complex JSON — especially when you're dealing with deeply nested objects, large arrays, or multiple levels of key-value pairs. Our tool goes much further.
Paste any JSON and choose between three views: a syntax-highlighted formatted view where keys, strings, numbers, booleans, and nulls are each a different colour; a collapsible tree view where you can click to expand or collapse any node; and a raw plain-text view for copying. A fourth tab converts the JSON to CSV if it contains an array of objects.
Features explained
Syntax highlighting
The highlighted output colours each element type differently — object keys in blue, string values in green, numbers in amber, booleans in red, and null values in purple. This colour-coding makes it immediately obvious what type each value is, which is particularly useful when auditing API responses, debugging config files, or reviewing data structures you didn't write yourself.
Collapsible tree view
The tree view renders your JSON as a hierarchical, collapsible structure. Click the ▶ arrow next to any object or array to collapse it and hide its contents. This is invaluable for large JSON files — you can collapse sections you're not interested in and focus on the parts that matter. No other free online JSON viewer in the standard category offers a true collapsible tree view without requiring an account or file upload.
Inline error detection
Most JSON validators online tell you "Invalid JSON" when something is wrong. We tell you exactly where. The error bar shows the specific error message from the browser's JSON parser, which includes the line number and character position of the syntax error — so you can go straight to the problem without scanning the entire document.
JSON stats panel
After formatting, a stats bar shows the total number of keys, the maximum nesting depth, the file size in bytes, and the root type (object or array). Key count tells you how large the JSON structure is. Depth tells you how deeply nested it is — important for APIs where some parsers have depth limits.
Sort keys A–Z
The sort keys function recursively sorts all object keys alphabetically at every nesting level. This is useful for comparing two JSON objects by diff, for standardising configuration files, and for making JSON easier to scan when you need to find a specific key in a large object.
JSON to CSV converter
If your JSON is an array of objects with consistent keys (the standard output from most REST APIs and database queries), the CSV tab converts it to a properly formatted CSV table. Headers are automatically extracted from the first object's keys. This is one of the most common JSON conversion tasks — turning API responses into spreadsheet-ready data — and having it built into the formatter saves opening a separate tool.
Download as .json
Download the formatted output as a formatted.json file with one click. Useful for saving a cleaned-up version of an API response, sharing a formatted config file, or archiving JSON data you're working with.
Common JSON errors and how to fix them
Unexpected token
The most common JSON error. Usually caused by a trailing comma after the last item in an array or object (which is valid in JavaScript but not in JSON), a missing quote around a key or string value, or a single-quoted string (JSON requires double quotes).
Unexpected end of JSON input
The JSON is incomplete — a closing bracket, brace, or quote is missing. Check that every opening { has a matching }, every [ has a matching ], and every string is properly closed.
Expected property name or '}'
An object has a trailing comma after its last key-value pair. Remove the comma after the last entry in the object.
Invalid number
Numbers in JSON must not have leading zeros (except for decimal numbers like 0.5), and cannot be NaN or Infinity — these are JavaScript values but not valid JSON.
Frequently asked questions
No. All formatting, validation, and conversion runs in your browser using JavaScript. Your JSON never leaves your device. You can safely paste API keys, authentication tokens, configuration secrets, or any sensitive JSON data.
Pretty printing (also called beautifying or formatting) takes compact, unindented JSON and adds whitespace — indentation, line breaks, and spacing — to make it human-readable. Minified JSON like {"a":1,"b":2} is valid but hard to read; pretty-printed JSON with 2-space indentation shows the structure clearly. Our tool does this automatically when you click Format.
These control how much horizontal space is used for each level of nesting. 2 spaces is the most common for web development and is what most JSON editors default to. 4 spaces is common in Python and some other ecosystems. Tabs are preferred by some developers and are the default in some code editors. All three produce valid, equivalent JSON — the choice is purely stylistic.
The JSON must be an array of objects where each object has the same set of keys — this is the standard format returned by most REST API endpoints and database queries. The tool extracts the keys from the first object as CSV headers, then outputs each object as a CSV row. Values containing commas are automatically wrapped in double quotes per the CSV standard.
This tool validates whether your JSON is syntactically correct (well-formed JSON). It doesn't validate JSON against a specific schema (checking whether values match expected types and formats defined in a JSON Schema document). For schema validation, you'd need a dedicated JSON Schema validator. This tool confirms your JSON is valid JSON — a necessary first step before any schema validation.