JSON Formatter & Validator
Paste JSON to format it, check that it is valid, or minify it. When it is broken you get the exact line and column, with a pointer to the problem.
FreeNo sign-upRuns in your browser: your data is not uploaded
The JSON errors you will meet most
- Trailing comma:
{"a": 1, "b": 2,}. JavaScript allows it, JSON does not. Remove the last comma. - Single quotes:
{'a': 1}. Keys and strings must use double quotes. - Unquoted keys:
{a: 1}is a JavaScript object, not JSON. - Comments:
// noteor/* note */are not allowed in JSON. Remove them, or use JSONC or JSON5 where a tool supports it. - Special values:
NaN,Infinityandundefinedare not valid. Usenullor a string. - Unescaped characters: a raw line break or tab inside a string must be written as
\nor\t, and a backslash as\\.
Format or minify?
Formatted JSON (with indentation) is for people: reading API responses, config files and logs. Minified JSON removes all spaces and line breaks to save bytes when sending data over the network. The content is the same either way.
Sorting keys
JSON objects have no required key order, but sorting keys A-Z makes two files easy to compare in a diff. Arrays are never reordered, because their order is part of the data.
Working with PHP or Laravel?
To turn JSON into a PHP array for a config file or a test, use the JSON to PHP array converter. In PHP itself, json_decode($text, true) returns an array and json_last_error_msg() tells you why decoding failed.
FAQ
How do I find the error in my JSON?
Is my JSON sent to a server?
Why is my JSON valid in JavaScript but not here?
What is the difference between format and minify?
Related guides
- Anatomy Agent Skill: Build Interactive Isometric SVGs
- WordCraft Explained: Install, Edit DOCX, and Export PDF
- Spectrum Outage: What Web Developers Need to Know
- OpenAI's Faster Fourier Transforms: Math and Reality
Link to this tool
Found it useful? Put a link in your docs, README or forum answer so others can use it too:
<a href="https://headsntail.com/tools/json-formatter">JSON Formatter & Validator</a> (free, by HeadsNTail)
[JSON Formatter & Validator](https://headsntail.com/tools/json-formatter)
Share: X LinkedIn Reddit WhatsApp
Need it done on your server? HeadsNTail sets up Laravel apps, cPanel hosting and migrations for businesses. See services or ask a question.