How to Validate and Format JSON with Eleventor

Format JSON, fix common syntax errors and inspect nested values, with examples and practical advice for checking repaired data.

How to Validate and Format JSON with Eleventor

A JSON response is much easier to debug when you can see where each object starts and ends. If you've ever searched through one long line of API data for a missing comma, you'll know why a formatter helps.

Our JSON formatter adds indentation, checks syntax and gives you a tree view for nested data. Here's how to use it without accidentally changing the values you need.

Start with a small example

Paste this into the editor and choose Format:

{"orderId":"A-104","items":[{"sku":"PEN","quantity":2}],"paid":false}

You'll get the same order ID, quantity and payment status, laid out on separate lines. Change the indentation if you prefer more space. Minify takes the extra whitespace out again.

For a larger response, open Tree View and search for a field such as quantity. Check the value before copying or downloading the result.

Fix the first error before the next one

This example contains two common mistakes:

{"name":"Sam", "active":True,}

JSON needs lowercase true, and the final property cannot have a trailing comma. The corrected version is:

{"name":"Sam", "active":true}

Property names and strings need double quotes. Comments, single quotes and unfinished brackets can also cause errors. The browser's error message may point just after the actual mistake, so check the text immediately before that position too.

Use Repair carefully

Repair tries to fix common problems with text substitutions. It doesn't know what your data means, and a replacement can affect a URL or another string that resembles a comment.

Save the original first. Compare the repaired values, especially addresses, identifiers and configuration settings. For an important config file, fixing the source by hand is often easier to trust.

Valid JSON can still contain the wrong data

These both pass a syntax check:

{"quantity":2}
{"quantity":"two"}

An API that expects a number can reject the second one. Check required fields and value types against the receiving API's documentation.

Also watch for long numeric IDs and duplicate keys. JavaScript can round numbers beyond its safe integer range, and parsing duplicate keys can discard an earlier value. Keep IDs as strings when the API allows it, and keep the original response if you need an exact record.

Be careful with real customer data

The formatter processes pasted text and selected files in your browser. The surrounding page still loads site resources and third-party scripts, so use a small, redacted sample when debugging private data.

The URL field contacts the address you enter. Don't put a secret or access token in that URL. If the browser blocks the request, cross-origin restrictions may be the cause.

For the format's exact rules, see the JSON specification.