JSON Formatter & Validator
Highly recommended Format, validate, repair and explore JSON in your browser. Exact numbers, property order and duplicate keys are kept.
- Repairs comments & trailing commas
- Foldable colored view
- Search & copy paths
- Sort keys A–Z
- Nothing is uploaded
Click any key or valueFormatting rules & limits
Formatting changes whitespace only. Exact number tokens, escaped strings, property order and duplicate keys are kept. Duplicate keys are flagged with their paths because applications may read them differently. Sort keys reorders object properties A–Z (duplicates stay next to each other) and never changes values.
Repair converts common near-JSON into valid JSON: it removes // and /* */ comments and trailing commas, turns single-quoted and curly-quoted strings into double-quoted ones, quotes bare property names, and changes True/False/None to true/false/null and NaN/Infinity/undefined to null. It lists every kind of fix it made, and Undo restores your original text. Check repaired data before using it.
Limits: 1,000,000 input UTF-16 units, 50,000 values, 128 nested containers, and 4,000,000 output units. Files must be at most 4 MB. The colored view shows up to 6,000 lines; the Text tab always has the full output. Errors include a line and column, and Show error selects the spot. Text stays in page memory and is not saved or uploaded.
Using JSON Formatter
Make JSON easier to read, reduce whitespace or diagnose syntax errors. Formatting preserves number tokens, string escapes, property order and duplicate keys.
- Paste JSON, open a local JSON file or load the example.
- Choose two spaces, four spaces or compact output, then format or validate.
- Read any error or duplicate-key warning, inspect the tree, and copy or download valid output.
Example
Input: {"id":9007199254740993,"active":true}
Formatted output keeps the exact id 9007199254740993; it is not rounded.Questions & answers
Does formatting round large numbers?
No. The formatter preserves the original number tokens, including large integers, exponent notation and negative zero. It changes whitespace rather than reserializing JavaScript numbers.
Why does JSON with comments or trailing commas fail?
Standard JSON does not allow comments, trailing commas or single-quoted strings. The error shows the line and column where parsing stopped.
What happens to duplicate property names?
They remain in their original order and trigger a warning. Applications may interpret duplicates differently, so check them before using the JSON.
Why does the tree show fewer entries than the output?
The viewer loads up to 100 entries per branch and 1,000 entries in total for responsiveness. The complete formatted output is independent of those display limits.
Guides for this tool
Examples and checks to help with your next step.
Help improve this tool
Report a problem or suggest an improvement
Describe the issue without pasting private tool input. Feedback goes to our admin inbox.
