JSON
JSON
About the JSON Formatter Tool
About the JSON Formatter Tool
Overview
A network response logged as one unbroken line of JSON is nearly impossible to scan by eye, and copy-pasting it into a code editor just to read it is a detour you shouldn't need. This tool turns that single line into an indented, readable tree instantly, and just as easily collapses a formatted JSON document back down to a compact one-liner for sending over the wire.
How to Use
- 1Drop your raw JSON — minified, multi-line, whatever shape it's in — into the text area.
- 2Choose Format under Mode to pretty-print it, or Minify to collapse it to a single line.
- 3If you're formatting, set the Indentation to 2 or 4 spaces to match your project's style.
- 4Click Format to run the conversion and see the result on the right.
- 5Use the copy button to grab the output straight to your clipboard.
Specifications & Glossary
- JSON (JavaScript Object Notation): The de facto data interchange format on the web, defined by the RFC 8259 / ECMA-404 standards. It is the default body format for REST APIs and is also used for config files like package.json and tsconfig.json.
- Format mode: Adds indentation and line breaks to make JSON easy to read. Nested objects and arrays are displayed in a hierarchical structure.
- Minify mode: Removes all line breaks and spaces to compress JSON into a single line. Useful for reducing network transfer size or when using JSON as an HTTP request body.
- Indentation: Sets the number of spaces to use in format mode (e.g., 2 spaces, 4 spaces). Select according to your team's coding style.
- Validation: Invalid input surfaces an error message instead of silently failing. Two of the most common gotchas: unlike JavaScript object literals, JSON keys must use double quotes (not single quotes), and a trailing comma after the last item or property is a syntax error, not a style choice.
Use Cases
- Formatting and debugging API responses for readability.
- Reviewing and editing configuration files such as package.json and tsconfig.json.
- Minifying JSON before sending it over the wire to shave off payload size.
- Tracking down an "Unexpected token" parse error caused by a trailing comma or a single-quoted key copied from JavaScript — paste the snippet here to spot exactly where it breaks.