TodayTools

JSON formatter

Turn a messy block of data into neat lines, spot the problem and get on with your day.

PrivateNo uploadsRuns in your browser

Donate
Mode

Beautify puts each item on its own line. Indent is the space before each line. Sort keys puts names in A to Z order.

Man Laptop

For the late fix

Messy data, clear in a second.

The bug hunt. Aniket finds the missing comma before dinner.

BeforeSquinting at one long line

With sdevNeat lines you can read

  • Happy Couple

    Morning check

    Read the app's reply over the first cup of coffee.

  • Business Team

    Shipped on time

    The team ships the update and heads out happy.

How to format JSON

  1. Paste or open

    Paste JSON into the Input pane, press Open to pick a .json file, or drop a file onto the pane. Sample loads a small home budget to try.

  2. Choose a mode

    Beautify indents with 2 spaces, 4 spaces or tabs. Minify strips every space and line break outside strings. Tick Sort keys to order keys alphabetically at every level. The output updates as you type.

  3. Copy or download

    Press Copy on the Output pane, or Ctrl+C (Cmd+C on Mac) with nothing selected to copy the whole result. Download saves data.json, or data.min.json when minified.

Good to know

  • Not strict JSON? The tool repairs JavaScript-style input: unquoted keys, single-quoted strings, trailing commas and comments. undefined and NaN become null.
  • Invalid JSON shows the line and column of the first problem, and Go to error selects that spot in the editor.
  • Files up to 2 MB open in the editor. Larger files stay out of it: you see the first 64 KB while a background worker reads the whole file, so hundreds of megabytes work without freezing the page.
  • Only the first 1 MB of the result is drawn on screen. Copy and Download always use the full output. Above 20 MB the Copy button is disabled; use Download instead.
  • Parsing uses the browser's JSON engine, so integers above 2^53 (about 9 quadrillion) lose precision. Keep such IDs as strings.
  • Everything runs in your browser. Nothing is uploaded.

Where people use it

  • Read an API reply

    Paste the one long line from an API and get neat, indented JSON you can read in seconds.

  • Find the broken comma

    When a config file will not load, the tool points to the exact line with the error.

  • Make it small for sending

    Minify the JSON to one line before you put it in a request or a settings field.

  • Open it in Excel

    Need the data in rows and columns for a report? Turn the same JSON into a spreadsheet.

    JSON to Excel converter
  • Turn it into CSV

    Flatten a list of records into CSV for a mail merge or an import.

    CSV to JSON and JSON to CSV converter

Why this one

It handles very large files in the background, so the page stays smooth, and it jumps you straight to the line that is wrong.

  • Shows the exact line and spot of any error.
  • Big files open without freezing the page.
  • Your JSON stays in your browser and is never uploaded.
  • No sign-up, works on phones too.

What you can change

  • Beautify or minify
  • Indent 2 spaces, 4 spaces or tab
  • Sort keys A to Z

People find this page by searching

  • json formatter
  • json beautifier online
  • json validator
  • format json online
  • json pretty print
  • json minify
  • json viewer
  • fix invalid json
  • json formatter large file
  • json lint
Cite this tool
  • APA
    sdev.in. (n.d.). JSON formatter, validator and minifier [Web tool]. https://www.sdev.in/tools/json-formatter
  • MLA
    "JSON formatter, validator and minifier." sdev.in, https://www.sdev.in/tools/json-formatter.
  • Chicago
    sdev.in. "JSON formatter, validator and minifier." https://www.sdev.in/tools/json-formatter.
  • BibTeX
    @misc{sdev-json-formatter,
      title = {JSON formatter, validator and minifier},
      author = {{sdev.in}},
      howpublished = {\url{https://www.sdev.in/tools/json-formatter}},
      note = {Web tool}
    }

Questions people ask

Why does it say my JSON is invalid?

Strict JSON needs double-quoted keys and strings, no trailing commas and no comments. The tool repairs those on its own; if it still fails, the error names the line and column and Go to error jumps there. The usual leftovers are a missing comma between items or a stray quote.

Can I format a very large file?

Yes. Files over 2 MB are not loaded into the editor; a background worker reads them straight from disk, so the page stays responsive. The result pane shows the first 1 MB and Download gives you the whole output.

Does Sort keys change the data?

No. Every value stays the same; only the order of keys changes, alphabetically at every nesting level. Arrays keep their order.

What is the difference between Beautify and Minify?

Beautify adds line breaks and indentation so the JSON is easy to read. Minify removes all whitespace outside strings to make the smallest payload. Both parse the input first, so both catch errors.

Is my data uploaded?

No. Parsing and formatting run in a web worker inside your browser. Nothing is sent to a server.

Donate