Sign up free

Online JSON Formatter and Beautifier

Paste JSON to pretty-print, validate or minify it, with errors pointed out by line and column.

About JSON Formatter

A JSON formatter turns a one-line API response or a cramped config file into something a person can read. Paste the JSON and it's pretty-printed right away with 2 spaces, 4 spaces or tabs, or squeezed into a single line with Minify when you need it small for a request or an environment variable.

If the JSON is broken, you see Invalid JSON with the position of the problem, given as line and column in Chrome, Edge and Firefox. It usually points at a missing comma, an extra comma or an unclosed quote. Sort keys puts object keys in alphabetical order, handy before comparing two files. The check is strict, so comments and single quotes count as errors. Save the result as data.json. To compare two JSON files, format both with Sort keys and paste them into Text Compare.

How to use JSON Formatter

  1. 1
    Paste your JSON

    Paste into Input, drop a .json file on the box, or click Open file.

  2. 2
    Pick the format

    Choose 2 spaces, 4 spaces, Tab or Minify, and tick Sort keys if you want.

  3. 3
    Fix any errors

    If the JSON formatter reports Invalid JSON, go to the line and column shown and correct it.

  4. 4
    Copy or save

    Copy the result or save it as data.json.

Why use Cubfile for this

  • Beautify or minify

    Indent with 2 or 4 spaces or tabs, or strip all whitespace.

  • Error position shown

    The first syntax error is located for you, so you don't hunt through the whole file.

  • Sort keys

    Alphabetical keys at every level make two JSON files easy to compare.

  • Stays in your browser

    API keys and customer data in your JSON are never uploaded.

FAQ

JSON Formatter: questions and answers

Why does the JSON formatter say my JSON is invalid?
Common causes are a trailing comma after the last item, single quotes instead of double quotes, comments, or a missing bracket. Check the line and column in the message.
Can the JSON formatter minify JSON?
Yes. Choose Minify and all indentation and line breaks are removed, and the character count shows the new size. Minified JSON that goes into a URL query string still needs URL encoding.
Does formatting change my data?
Only spacing changes, plus key order if you tick Sort keys. The one exception is whole numbers above 9007199254740991, which browsers round, so keep long IDs as strings.
Is my JSON sent to a server?
No. Parsing and formatting run in your browser, so tokens and personal data inside stay on your device. There's no daily limit.
Can I open a large JSON file?
Yes. Open it or drop it on the input box. Big files just take a moment longer, and the whole file is handled on your device.
Share JSON Formatter with a friendIt runs in any browser, and they can try it without signing up.

Related tools

TXT Text CleanerRemove extra spaces, empty lines and broken line breaks in one click.
TXT Text CompareCompare two texts side by side and see every change.
TXT Word CounterCount words, characters, Chinese characters, lines and reading time live.
TXT Base64 Encode and DecodeEncode and decode Base64 text and files.
AaTXT Case ConverterUPPER, lower, Title, Sentence, camelCase, snake_case and more.
TXT Find and Replace TextReplace words in text in bulk, with regular expressions if you need them.
TXT Password GeneratorMake strong random passwords on your device.
TXT Remove Duplicate LinesDelete repeated lines and sort what’s left.