How to format, validate and minify JSON
- Paste your JSON into Input, open a local
.jsonfile, or click Sample to load an example payload. - Your JSON is validated automatically as you type. Any syntax error is underlined directly in the editor and reported with its exact line and column number—with nothing to click.
- Choose your preferred indentation (2 spaces, 4 spaces, or tabs) and optionally check Sort keys to order object properties alphabetically, then click Format to pretty-print or Minify to strip all insignificant whitespace.
- Switch the output pane from Text to Tree to explore complex structures interactively: click any object or array to fold or unfold it, inspect key and item counts, or use Expand all and Collapse all.
Why use this JSON formatter and validator?
- Exact 64-bit and big integers: standard JavaScript
JSON.parse()rounds integers above 253 − 1 (9,007,199,254,740,991), corrupting 64-bit database keys, Snowflake IDs, and transaction identifiers. This formatter copies numeric literals verbatim so big numbers never lose precision. - Alphabetical key sorting: enabling Sort keys orders every object's keys from A to Z at every nesting level, making it easy to compare two JSON payloads with
git diff. - Handles multi-megabyte files smoothly: large JSON documents are parsed and formatted inside a background Web Worker so your browser tab never freezes.
- 100% client-side privacy: sensitive API responses, tokens, and customer records stay inside your browser and are never transmitted over the network.
Common JSON syntax errors and how to fix them
JSON (RFC 8259 / ECMA-404) has a stricter grammar than JavaScript object literals. The validator catches and highlights the most frequent mistakes:
- Trailing commas: a comma after the last item in an object or array (such as
{"a": 1,}or[1, 2,]) is invalid in standard JSON—remove the final comma. - Single quotes: keys and strings must be wrapped in double quotes (
"key"), never single quotes ('key') or backticks. - Unquoted property names: every object key must be a double-quoted string (write
{"id": 1}instead of{id: 1}). - Comments:
//single-line and/* */block comments are not part of the JSON specification and must be removed before parsing. - Special numeric values and leading zeros:
NaN,Infinity,-Infinity,undefined, hexadecimal numbers (0xFF), and leading zeros (007) are not valid JSON values; represent them as strings ornullinstead. - Unescaped control characters: literal line breaks or tabs inside a string must be escaped as
\n,\r, or\t.
Frequently asked questions
- Why do other online JSON formatters change or round long ID numbers?
- Most browser-based JSON tools rely on JavaScript's built-in
JSON.parse(), which converts every number into a 64-bit IEEE 754 floating-point value. Any integer larger than 253 − 1 (9,007,199,254,740,991)—such as 64-bit database IDs, Snowflake IDs, or financial identifiers—silently loses precision. Pixlint tokenizes and formats numbers directly from the source text, keeping every digit exact. - What is the difference between formatting and minifying JSON?
- Formatting (pretty-printing) adds consistent line breaks and indentation (2 spaces, 4 spaces, or tabs) so humans can read and debug the structure. Minifying strips all unnecessary whitespace and line breaks outside of string values to produce the smallest possible payload for network transmission or storage.
- Is my JSON data uploaded to a server?
- No. Formatting, validation, minification, and tree rendering run 100% locally in your browser. Your JSON payloads, API keys, and logs never leave your device.
- How can I convert JSON into CSV, YAML, or XML?
- Use the sub-menu above the editor to switch to the JSON to CSV Converter for spreadsheets, the JSON to YAML Converter for configuration files, or the JSON to XML Converter for XML documents.