Magic Tools
Back

JSON Formatter

Mode:
Indent:

Input

Output

How to use / Why use this tool / FAQ

How to use

Paste JSON text or drag a .json file into the input area — syntax highlighting and line numbers appear instantly, and syntax errors are underlined in place with their exact line and column. Choose Format to beautify with proper indentation, Minify to compress into a single line, Validate to check syntax, or Escape / Unescape to convert between JSON text and an escaped string for embedding in code. Browse large results with code folding: collapse or expand any object and array from the gutter, or use the Collapse All / Expand All buttons. Press Ctrl+F (Cmd+F on Mac) or click Find to search inside the editor, with regex and case-sensitive options. Toggle 'Sort keys' to alphabetically sort all object keys, and 'Escape non-ASCII' to convert Unicode characters to \uXXXX sequences. Copy the result to clipboard or download as a .json file.

Why use this tool

JSON formatting is a daily task for web developers, API integrators, and data engineers who work with configuration files and REST APIs. This tool handles everything in your browser — no data ever leaves your device, making it safe for sensitive payloads. Use it to debug API responses that are hard to read when minified, clean up config files before committing them to version control, or prepare JSON for documentation and code reviews. The validator helps you catch syntax errors before they reach production. Minification is useful when you need to reduce request payload sizes for performance-sensitive applications.

FAQ

Is the JSON formatter free and secure?
Yes. Completely free, no sign-up required. Your JSON is processed locally in the browser — nothing is sent to our servers.
What is JSON formatting (beautify)?
Formatting adds consistent indentation and line breaks to make JSON human-readable. For example, {"a":1,"b":2} becomes a multi-line structure with 2-space indent. Useful for reading complex nested objects.
What does 'Sort keys' do?
It recursively sorts all object keys alphabetically throughout the entire JSON tree. Helpful for comparing two JSON objects or ensuring consistent key order in configuration files.
How do I fix a JSON syntax error?
Click Validate — the tool highlights the first error with its line and column number. Common issues: trailing commas (not allowed in JSON), single quotes instead of double quotes, missing commas between items, or unquoted keys.
What is JSON minification?
Minification removes all whitespace, newlines, and indentation to produce the smallest possible JSON string. Use it to reduce payload size for API requests or when storing JSON in databases.
Does it support code folding and search?
Yes. Both editors show a fold gutter — click the arrow next to any line number to collapse an object or array, or use Collapse All / Expand All. Press Ctrl+F (Cmd+F on Mac) or click Find to open the search panel, which supports regex, case-sensitive, and whole-word matching.
How do I escape or unescape a JSON string?
Use the Escape mode to convert JSON text into an escaped string (quotes and control characters become \" and \n) for embedding in code, and Unescape to reverse it. The 'Escape non-ASCII' option additionally converts Unicode characters like Chinese or emoji to \uXXXX sequences.
Is there a file size limit?
No hard limit. Processing is done in the browser, so very large files (>10MB) may be slow depending on your device. For most API responses and config files there is no noticeable delay.

Related Guides