Quick answer: To format JSON, paste it into a JSON formatter and click Format; it adds indentation and checks syntax. The most common JSON errors are trailing commas, single quotes, unquoted keys, comments and missing brackets.
JSON (JavaScript Object Notation) is the language APIs use to talk to each other. It is simple, but one missing quote can break everything. This guide covers the basics, the most common errors, and how a JSON formatter saves you time.

What does JSON look like?
{
"name": "OneStop Online Tools",
"free": true,
"categories": ["pdf", "image", "text"],
"toolCount": 107
}JSON is made of objects (curly braces with key/value pairs) and arrays (square brackets with lists). Values can be strings, numbers, booleans, null, objects or arrays.
The 5 most common JSON errors
- Trailing commas —
[1, 2, 3,]is invalid. - Single quotes — strings and keys must use double quotes.
- Unquoted keys —
{name: "x"}must be{"name": "x"}. - Comments — standard JSON does not allow
//or/* */. - Missing brackets — every
{and[needs a partner.
How to format and validate JSON
- Paste your JSON into the JSON Formatter & Validator.
- Click Format to pretty-print it, or Minify to remove whitespace.
- If there is an error, the message tells you what went wrong.
Encoding data for APIs and URLs
When you send data in a URL, special characters like spaces and & must be encoded. Use the URL Encoder/Decoder to convert hello world into hello%20world and back.
APIs and data URLs often use Base64 to carry binary data as text. Convert either way with the Base64 Encoder/Decoder — it fully supports UTF-8 and emojis.
Working with colors and number systems
Front-end developers regularly switch between HEX, RGB and HSL — the Color Picker handles all three. Working with tokens or timestamps from an API? Decode them with the JWT Decoder and the Timestamp Converter, and test patterns with the Regex Tester.
See all free developer tools.
The five most common JSON errors (with fixes)
- Trailing comma:
{"a": 1,}is invalid. Remove the last comma:{"a": 1}. - Single quotes:
{'name': 'Ali'}is invalid. JSON needs double quotes:{"name": "Ali"}. - Unquoted keys:
{name: "Ali"}works in JavaScript but not in JSON. Quote every key. - Comments:
// noteand/* … */are not allowed in JSON. Move notes into a field such as"_comment". - Special values:
NaN,undefinedandInfinityare not valid JSON. Usenullor a string instead.
The JSON Formatter & Validator shows the line and position of the first error, so you can jump straight to it.
Pretty-print vs minify: when to use each
Pretty-printed JSON (2 or 4 spaces of indentation) is for people: reading API responses, reviewing config files and spotting mistakes. Minified JSON removes all spaces and line breaks, which makes files smaller for sending over the network or storing in a database. The data is identical either way — only the whitespace changes.
JSON vs a JavaScript object
JSON looks like a JavaScript object but is stricter: keys must be in double quotes, strings must use double quotes, and functions, dates and comments are not allowed. In JavaScript, convert with JSON.parse(text) and JSON.stringify(value, null, 2).
Frequently asked questions
Does the order of keys matter in JSON?
No. JSON objects are unordered, so {“a”:1,”b”:2} and {“b”:2,”a”:1} hold the same data. Arrays, however, keep their order.
Is my JSON uploaded when I format it?
No. Our formatter runs entirely in your browser, so API keys or private data in your JSON never leave your device.
What is the difference between JSON and JSON5?
JSON5 is a relaxed extension that allows comments, trailing commas and single quotes. Many config files use it, but APIs and most parsers expect strict JSON.
Can I convert a spreadsheet to JSON?
Yes. Save the sheet as CSV and use the CSV to JSON Converter.
Keep reading: related guides
This guide is part of our free developer tools collection. Browse all free online tools or the full guide library.

