How to use this tool
- Upload a JSON or TXT file, or paste JSON.
- Choose spaces, tabs or Minify; optionally sort object keys.
- Valid input updates after a brief typing pause. You can also use the main action button. Resolve errors before copying or downloading.
- Clear input keeps the conversion settings; Undo input change restores the previous inputs after clear or reverse. Reset restores the example and default settings.
Understanding the output
Successful output means the input can be parsed as JSON. It does not prove that the data follows your application’s schema. Formatting reserializes the parsed value, so whitespace, escaping, duplicate object keys, and some numeric representations may change.
For a JSON array of records that needs a spreadsheet-style export, use JSON to CSV Converter and review the field mapping.
An object with one property
The compact input {"a":1} becomes a three-line object in two-space mode, with two spaces before "a": 1. Minify mode returns the same value without indentation. With Minify and Sort object keys enabled, {"z":2,"a":1} becomes {"a":1,"z":2}.
Syntax validity is only the first check
A syntactically valid payload can still be wrong for an API. Required fields may be missing, an ID may have the wrong type, or a value may fall outside the accepted range. Use the receiving system’s schema or documentation for those checks. This formatter validates JSON grammar and makes the structure easier to inspect; it does not know the rules of a particular service.
JSON requires double-quoted property names and strings. Comments, trailing commas, undefined, NaN, and JavaScript function expressions are not JSON. Remove or convert those constructs at their source instead of assuming that any JavaScript object literal can be pasted unchanged.
Preserve precision and duplicate-key meaning
This tool uses native JavaScript parsing. Large integers can lose precision, and duplicate object keys retain only their final value. If exact long identifiers or financial decimals must survive, represent them as strings or use a precision-preserving data pipeline. Keep an original copy before formatting a payload whose textual representation is legally or cryptographically significant.
Method and supported input
JSON.parse validates the input; JSON.stringify writes compact output, spaces or tabs. Optional key sorting reorders objects while retaining array positions. No input code is executed.
File input is decoded locally as UTF-8, or UTF-16 with a byte-order marker. Downloads use UTF-8 and retain the imported filename with a .json extension.
Sorted keys use character-code order within each object; arrays keep their order and integer-like keys follow JavaScript property enumeration. This is formatting, not canonical JSON for signing.
- Native JavaScript numeric precision is acceptable for the data.
Limitations
- This is not JSON Schema validation or JSON5 support.
- Duplicate keys and exact numeric spellings are not preserved. Numbers outside JavaScript’s finite numeric range are rejected rather than converted to null.
- Files must be JSON or TXT, at most 1 MB and 100,000 characters. Compressed files and binary document formats are not supported.
Common questions
Will this execute JavaScript inside a string?
No. Strings remain data. The input is parsed as JSON and the output is displayed as plain text.
Is minified JSON compressed?
No. Minification removes optional formatting whitespace. Network compression is a separate process.
Can I format and download a JSON file?
Yes. Choose a JSON file and an output style. Valid edits update automatically; Download JSON saves the current result. Use output as input replaces the source and Undo input change restores it.
Sources and further reading
Reviewed on