devtools.codes

JSON Formatter & Converter

RUNS LOCALLY

Format a JSON document so it can be read, minify it so it can be shipped, sort its keys so two versions can be compared, or convert an array of objects into CSV. Invalid input is located and explained rather than quietly repaired, so the mistake you came to find is still there when you look.

Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information.

How to use the JSON Formatter & Converter

  1. Paste the document. It can be minified, prettified, or the inconsistent mixture a log file usually contains.
  2. Choose an indent, or minify instead. Two spaces, four spaces and tabs all produce identical data.
  3. Turn on key sorting before comparing two documents, so ordering differences stop hiding the real one.
  4. Convert to CSV if the document is an array of objects. Columns come from the union of every key.

A worked example, and what it shows

The example is a small array of order records, minified onto one line with keys in inconsistent order between the two entries, and one value containing a comma. It is the shape an export endpoint usually returns rather than a tidy hand-written document.

Formatting makes the structure readable, and sorting keys puts the two records into the same order so they can be compared by eye. The CSV conversion quotes the value containing a comma, which is the detail that breaks a naive export written by hand.

Press Example in the workspace above to load it.

Common questions about the JSON Formatter & Converter

Does formatting change my data?

No. Formatting changes whitespace, and sorting changes the order keys are written in. Neither changes a value, and an object is defined as unordered, so sorted output is the same document. Array order is left alone, because position in an array is meaning rather than layout.

Why sort keys before diffing?

Because two documents that differ only in key order produce a difference on almost every line, which buries the one value that actually changed. Sorting both sides first removes that noise. The JSON Diff tool ignores key order for you, but sorting helps when you are comparing by eye or with an ordinary text diff.

Why will it not fix my trailing comma?

Because repairing input destroys the evidence you came to look at. If a service is emitting a trailing comma, that is the bug, and a tool that silently absorbs it means you ship the broken producer. The error names the position so you can fix it at the source instead.

Can it convert to YAML?

Not at present. YAML needs a real parser to do correctly, and a hand-written one would be wrong in ways that are hard to notice, particularly around multi-line strings and type coercion. CSV conversion is here because it can be done correctly without a dependency.

Does my input leave the browser?

No. Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information. That distinction matters here, because a JSON document pasted into a formatter is very often a real API response containing real customer records.