How to use the JSON Formatter & Validator
- Paste JSON into the input, or drop a
.jsonfile onto it. - Choose Format, Minify or Apex string, and the indentation you prefer.
- Turn on “Sort keys” to order every object’s keys alphabetically, which makes two payloads easy to compare.
- Copy the result or download it as a file.
What a JSON formatter does
APIs usually return JSON on a single line to save bytes. A formatter adds line breaks and indentation so you can see the structure: which objects are nested, what each array holds and where a value is missing. Minifying does the opposite, for when you need the smallest possible payload.
Why number precision matters
Many online formatters use JavaScript’s JSON.parse, which turns every number into a 64-bit floating point value. Integers above 9,007,199,254,740,991 are silently rounded, and 1.0 becomes 1. This formatter never converts numbers, so record numbers, external IDs and money values come out exactly as they went in.
Common JSON errors
- A trailing comma after the last item:
[1, 2,]. - Single quotes instead of double quotes:
{'name': 'Acme'}. - Keys without quotes:
{name: "Acme"}. - Comments, which JSON does not allow.
- A missing comma between two properties.
JSON in Apex
To put JSON in Apex, for example as a test fixture, use Apex string mode. It escapes the single quotes and backslashes for you.
String jsonBody = '{"name":"O\'Brien","active":true}';
Map<String, Object> data = (Map<String, Object>) JSON.deserializeUntyped(jsonBody);To turn the same JSON into typed wrapper classes, use the JSON to Apex Class Generator.
Features and limitations
What it does
- Validates as you type and points to the exact line and column of the first error, with a plain explanation.
- Keeps numbers exactly as written:
1.0stays1.0and integers too large for JavaScript are not rounded. - Warns about duplicate keys, which most parsers silently overwrite.
- Apex string mode produces
String jsonBody = '...';with every quote escaped, ready for a test or a callout. - Shows size, depth and how many objects, arrays and keys the document has.
What it does not do
- Strict JSON only: comments, trailing commas and single-quoted strings are reported as errors, as Apex would.
- It does not validate against a JSON Schema.
- Escapes inside strings may be normalised, for example
\u00e9becomesé. The value is unchanged.