Format and validate JSON

Paste a JSON response, a request body or a fixture and get it back indented, minified or with its keys sorted — or, if it does not parse, the line and column where it stops being JSON and the most likely reason. It runs in the page, so an API response with real customer data in it is not posted to anyone.

The three mistakes it catches most

Single quotes instead of double quotes, a trailing comma after the last item, and comments. All three are legal in JavaScript object literals and in several config formats, and none of them is legal JSON. A parser that rejects them is right; the useful part is being told which one it was.

Why sorting keys helps in tests

Two JSON documents with the same data can differ only in key order, and a plain text diff reports every one of those as a change. Sorting keys on both sides before comparing removes the noise, which is what a snapshot or golden-file test should do before it decides a response changed.

Valid JSON is not a valid response

Parsing proves the syntax. It says nothing about whether the fields your client needs are present, typed the way it expects, or within range — that is a schema or contract check. Format the body here to read it, then assert on it with a contract test.

Other tools

All tools · Getting started guide · All 55 mock REST APIs

Last updated