How to use JSON Formatter
- 1Paste JSON into the input, drop a .json file onto it, or click Open file.
- 2If it is invalid, read the error with its line and column, click Show in editor to jump there, or click Fix automatically when offered.
- 3When it is valid, choose Beautify or Minify, an indent of 2 spaces, 4 spaces or tabs, and Sort keys if you want keys in A to Z order.
- 4Switch to Tree view to explore nested data, then Copy, Download or Use as input.
Clear error messages
Browser error messages like Unexpected token } in JSON at position 214 are hard to act on. This validator reports the line and column, shows the line with a marker under the problem, and explains common causes in plain words: a missing comma, a trailing comma, single quotes, unquoted keys, comments, Python's True and None, or an unescaped line break inside a string.
One-click fixes
Fix automatically repairs the most common reasons JSON copied from JavaScript, config files or Python is rejected: it removes // and /* */ comments and trailing commas, adds double quotes around keys, converts single-quoted strings, and changes True, False and None to true, false and null. Text inside strings is never changed. Review the result before using it.
Tree view, sorting and privacy
The tree view lets you fold and unfold objects and arrays; hover any value to see its path, such as $.users[0].email. Sort keys orders every object's keys alphabetically, which makes two JSON files much easier to compare.
Everything runs in your browser, so API responses, tokens and customer data are never uploaded. Note that numbers with 16 or more digits cannot be stored exactly in JavaScript; the tool warns you when it sees them.
Valid JSON that may not mean what you think
A green result means the syntax is correct. These three cases pass validation but can still surprise you (all tested here):
The first is duplicate keys. {"id": 1, "id": 2} is accepted and formats as {"id": 2}: the last value silently wins. The JSON standard, RFC 8259, says names should be unique and that software receiving duplicates behaves unpredictably, so another program may keep the first value instead. If a key appears twice in your source, fix the source.
The second is large integers: 9007199254740993 comes out as 9007199254740992, because browsers store numbers as 64-bit floating point, which is exact only up to 9,007,199,254,740,991. The tool warns when it sees 16 or more digits, and order numbers and IDs like this should be strings. The third, escaped text, is harmless: "\\uae40\\ubbfc\\uc9c0" formats as the readable name 김민지. This is the same value, just written differently, which is handy for reading output from programs that escape every non-English character.
Near-JSON formats and how to handle them
JSON Lines (one object per line, common in logs and data exports) is not a single JSON value, so pasting two lines gives "Unexpected '{' after the end of the JSON value" at line 2, column 1. To format one record, paste that line alone; to turn the whole file into a table, use JSON to CSV, which reads JSON Lines directly.
Python output is a near miss of a different kind. Printing a dictionary gives {'name': 'Kim', 'active': True, 'score': None}, which fails at line 1, column 2, and Fix automatically turns it into {"name": "Kim", "active": true, "score": null}. JavaScript objects and config files with comments or trailing commas are handled by the same fix. Check the result, since the fix assumes the intent was ordinary JSON.
Frequently asked questions
How do I find the error in my JSON?
Paste it here. The error box shows the line and column, highlights the spot, and Show in editor selects it in the input.
Why is a trailing comma invalid in JSON?
The JSON standard does not allow a comma after the last item in an object or array, even though JavaScript does. Fix automatically removes them.
Can JSON have comments?
No. Standard JSON does not allow comments. Files like tsconfig.json use JSONC, a variant with comments; Fix automatically strips them.
Is it safe to paste API keys or private data?
Yes. The JSON is processed in your browser and never sent to a server.
What does minify do?
It removes all spaces and line breaks to make the JSON as small as possible, for example for API payloads or config values.
Why did one of my duplicate keys disappear?
When an object repeats a key, the browser keeps the last value. The JSON standard says duplicate names make behavior unpredictable, so other software may keep the first one. Rename or remove the duplicate in the source.
Why did my 19-digit ID change?
Browsers store JSON numbers as 64-bit floating point, which is exact only up to 9,007,199,254,740,991. Larger integers are rounded; in our test 9007199254740993 became 9007199254740992. Keep long IDs as strings.
How do I format a .jsonl or log file?
Each line is a separate JSON value, so paste one line at a time to format it. To view the whole file as a table, open it in JSON to CSV, which reads JSON Lines.
Does Sort keys change my data?
No values change, only the order of keys inside each object. Arrays keep their order, because order in an array is part of the data. Sorting makes two versions of the same file much easier to compare in a diff tool.


