JSON Minifier

JSON on one line, with the whitespace taken out.

FREE - NO SIGN-UP - RUNS ON YOUR DEVICE

Nothing leaves this browser tab

  • 1 lineout
  • 0data changed
  • 0uploads
  • 1 tapto copy
Specification

JSON Minifier at a glance

Input
Pasted JSON and an action
Output
One-line JSON
What is removed
Whitespace between tokens only
If it will not parse
Position of the parse failure
Method
Native parsing, no indentation
Price
Free
Account needed
None
Where processing happens
On your device
How to

How to use JSON Minifier

  1. 1

    Paste the JSON

    Paste the indented JSON.

  2. 2

    Take the one-line result

    Read the single-line output.

  3. 3

    Copy the one line

    Copy it, or save it as a file.

Questions

Frequently asked questions

Will minifying break my JSON?

No, so long as it parses. Only whitespace between tokens is dropped, and spaces inside string values are data and are kept as they are.

How much smaller does it get?

It depends entirely on how much indentation was there. Deeply nested, heavily indented files lose the most; a flat object with few keys loses very little.

It will not minify. What is wrong?

The text did not parse. The line and column where the parser stopped is reported, and a trailing comma or a single quote is the usual reason.

Is anything sent away to do this?

No. Parsing and output both happen in this browser tab. Nothing reaches a server, and nothing is stored in an account.

Background

When one line is the right shape

Paste indented JSON and the one-line version appears. Only spaces, tabs and line breaks go; every key, value and nesting level survives exactly.

  • Config fields and environment variables often take a single line, which is the main reason to strip the whitespace.
  • Request bodies do not need indentation; the parser at the other end reads the same object either way.
  • Keep the indented copy for editing and minify at the end, rather than working in one long line.
  • Minified output is not obscured. Anyone can indent it again, here or anywhere else.

Full specification

Specification of the JSON Minifier tool
InputPasted JSON, indented or not, and the minify action.
OutputThe same JSON on a single line, with spaces, tabs and line breaks removed.
What is removedWhitespace between tokens only. Spaces inside string values are part of the data and stay.
If it will not parseNothing is minified. The line and column where the parse stopped is reported instead.
MethodThe browser's own JSON parser, then output with no indentation.
PriceFree. Supported by clearly labelled ads outside the working area.
Account neededNo.
Where processing happensIn your browser tab. Your input is never uploaded.
Next step

Keep going with the same files

All developer tools: Developer tools on SPOTTOOLS