JSON Formatter
Format or minify JSON, pinpoint errors by line and column, auto-fix almost-JSON, and view it as a tree or CSV.
Input
Result
Valid JSON ✓ · 4 keys · depth 2 · 121 B → 133 B
Format or minify JSON, pinpoint errors by line and column, auto-fix almost-JSON, and view it as a tree or CSV.
Valid JSON ✓ · 4 keys · depth 2 · 121 B → 133 B
Tidies up JSON that sits on one line so it is easy to read, and finds syntax errors.
Paste your JSON.
Click format or minify.
If there is an error, fix the position that is marked.
Yes. When there's an error, an 'Auto-fix' button appears and converts comments, trailing commas, single-quoted strings and unquoted keys into standard JSON. For errors that fixing doesn't resolve, it tells you the line and column position.
In the 'Formatted result' view, choose from 2 spaces, 4 spaces, tab or minified. Minifying removes all whitespace and line breaks to reduce the size. Turning on 'Sort keys by name' arranges object keys in alphabetical order.
Switch to the CSV view. It only converts when the JSON is an array of objects, like [{"a":1},{"a":2}]. Keys become column names, and nested values are put in as JSON strings. Press the save button to download it as data.csv.
Formatting adds line breaks and indentation so that people can read it easily. Minifying removes all spaces and line breaks to reduce the size. The content is exactly the same, so use formatting when reading and editing, and minifying when sending to a server or storing.
The most common is a trailing comma after the last item (for example {"name":"moa","age":3,}). It is allowed in JavaScript code but is an error in the JSON specification. Next come single quotes, unquoted keys and comments (//, /* */).
JSON strings and keys must always be wrapped in double quotes ("). Sometimes quotes in copied data have turned into curly quotes (“ ”) and cause errors. This tool points to the wrong place by line and column, and fixes JSON that has comments or single quotes mixed in and shows it.
The tree view is handy for deeply nested JSON when you want to expand and collapse to see which value sits inside which. CSV conversion is for when you want to open a list of repeated items of the same shape (for example a member list) in Excel or Google Sheets. If each item has a different structure, it can be hard to turn into a table.
This tool processes what you enter only inside your browser and does not send it to a server. Even so, when handling JSON that contains passwords, authentication keys or personal data, it is safer to get into the habit of leaving only the parts you need or masking the values.
A JSON value can be only one of six types: string, number, boolean, null, array or object.
Anything else has to be replaced with an alternative representation.
undefined
NaN, Infinity
Date
Functions
JavaScript handles numbers as double-precision floats, so integers larger than 9,007,199,254,740,991 can't be represented exactly.
That's why reading a very large ID sent by a server in JavaScript can change its last digits.
Large IDs and payment numbers are often exchanged as strings.
JSON is a text format for exchanging data, while a JavaScript object is a value inside a program, so JSON's syntax is stricter.
Quotes on keys
Single-quoted strings
Comments
Trailing commas
This tool has options that automatically fix comments, trailing commas, single quotes and unquoted keys.
If you see double quotes full of backslashes, the JSON has been wrapped in a string one extra time.
In that case, turn on the option to extract JSON from a string, and it strips the outer quotes and the escapes so you can see the original structure.
This pattern is common in log files and API responses.
You can't put an actual line break or tab inside a JSON string; you have to use escape notation.
Line break
Tab
Double quote
Backslash
Unicode character
Look at the line and column numbers in the error message, and check what comes just before the spot the arrow points to.
Syntax errors are often detected later than where the real cause is, so it helps to check whether a comma or quote is missing right before the indicated position.
JSON Lines puts one JSON value on each line, so pasting the whole thing at once is reported as invalid JSON.
For this kind of log, check one line at a time, or wrap it in brackets and add commas to turn it into an array before checking.
If an invisible character called a BOM is attached to the start of the file, some programs can't read the JSON.
Some editors save with a UTF-8 BOM, so if pasted JSON gives an error for no apparent reason, delete the very beginning and try again.
Sorting keys alphabetically makes it easier to compare two JSON documents, and the size display shows how much the size changed before and after cleanup.
Curly braces hold a collection of keys and values (an object), square brackets hold a list of values (an array), and the two nest inside each other to form the structure.
With this tool's tree view you can collapse and expand objects and arrays to skim a deep structure easily.
{ }
[ ]
:
,
Paste in a response that was compressed onto one line and format it, and you can find the value you need right away.
If it's an array holding several objects, you can convert it to CSV.
For an array of objects with the same keys, like [{"a":1},{"a":2}], the keys become column names and each object becomes one row.
If it isn't an array or the structure varies, it's hard to make a table, so this tool tells you it needs to be an array of objects.
In the JSON standard the order of keys in an object has no meaning, so differently ordered objects are treated as the same data.
Still, when people compare two files or look at changes in version control, it's easier if the order matches, so sorting keys by name helps.
Order does matter in arrays, so sorting them would change the data; be careful.
This tool's key sorting only sorts object keys and leaves the order of items inside arrays untouched.
Standard JSON has no comments, so if a config file needs them, use an extended format such as JSONC or JSON5.
JSON
JSONC
JSON5
Minifying by removing whitespace is the easiest way, and restructuring to cut down repeated keys has an even bigger effect.
This tool shows the size before and after cleanup, so you can see the effect of minifying right away.
The most important thing is to apply the same convention consistently within a project.
camelCase
snake_case
kebab-case
You can write key names in Korean or other non-Latin scripts, but most systems use English keys for compatibility.
The three mean different things, so use them deliberately to avoid confusing the receiving side.
Value is null
Empty string
Missing key
Empty array
The standard only recommends that keys not repeat and doesn't enforce it, so results differ depending on the program reading it: some use the last value, others the first.
In most JavaScript environments, the later value overwrites the earlier one.
Duplicate keys aren't an error, yet they easily cause unintended data loss, so if the key count after formatting is lower than you expected, suspect duplicates.
JSON has no dedicated date type, so dates are written as strings or numbers, and the most common approach is an ISO 8601 string.
ISO 8601 string
Unix seconds
Unix milliseconds
Mixing methods causes confusion when parsing, so stick to one approach within a single API.
This tool processes the JSON you enter only inside your browser, but it's a good habit to be careful whenever you handle sensitive information.
If every double quote has a backslash in front of it, the JSON has been placed inside a string one extra time.
This is how it looks when log collection tools or some APIs send JSON inside a string field.
Turn on this tool's option to extract JSON from a string, and it strips the outer quotes, unwraps one layer and formats it.
If it's wrapped in two or more layers, paste the extracted result back in and unwrap it once more.
Use it when you need to tidy up input that isn't strict JSON, such as hand-written settings or an object copied from JavaScript code.
Auto-fix only handles common cases, so always check that the result matches what you intended.
Switching to the tree view expands only the upper levels, so you can skim the whole structure quickly.
Use the key count and depth shown at the bottom to get a sense of the scale first, then expand only the branches you need to check values.
If the depth is excessive, it may be worth simplifying the API design.
Even when the syntax is correct, errors occur if the structure or data types differ from what the program expects.
This tool only checks syntax. For structural validation, also use your program's schema checks.