JSON-LD Minifier and Prettifier

Indent JSON-LD for reading or compress it for your page, with every number and string copied exactly as written.

How to use

What it checks and how it works

The tool parses the input as strict JSON with the jsonc-parser library, the way Google reads JSON-LD (RFC 8259), and prints it again from the parse tree. Numbers and strings are copied exactly as you wrote them, so a 14-digit GTIN or a long identifier is not rounded the way JSON.parse followed by JSON.stringify would round it. Key order is kept. Comments and trailing commas are reported as errors with a line and column, because they are not valid JSON. Escaping the less-than sign writes it as the six characters \u003c inside strings, so a string can never close the script tag early; the meaning of the data does not change. The tool does not check types or properties, and it does not sort keys or fix invalid JSON for you: use the JSON-LD checker for that.

Does minifying change my data?

No. The tool removes only whitespace. Numbers and strings are copied exactly as written and the key order is kept.

Why not use JSON.parse and JSON.stringify?

They round numbers that do not fit a double, such as a long GTIN written as a number. This tool prints the original text of every value.

What does escaping the less-than sign do?

It writes the character as an escape sequence inside strings, so text like a closing script tag cannot end the block early. A JSON reader sees the same data.

Sources

Related tools

Privacy

Runs in your browser; nothing is uploaded. The interactive tool needs JavaScript.