What is JSON?
JSON (JavaScript Object Notation) is the most common text format for sending data between programs - web APIs, config files and databases all use it. It is built from objects ({"key": "value"}), arrays ([1, 2, 3]), strings, numbers, true, false and null.
The most common JSON errors
- Trailing commas -
{"a": 1,}is not allowed in JSON, even though JavaScript allows it. - Single quotes - keys and strings must use double quotes.
- Unquoted keys -
{a: 1}is valid JavaScript, not JSON. - Comments - JSON has none. Remove
//and/* */. - Special values -
NaN,Infinityandundefinedare not valid.
Privacy
Formatting happens in your browser with the built-in JSON parser. Your data is never uploaded, so it is safe to use with private payloads - though you should still avoid pasting live secrets into any web page on a shared computer.
Frequently asked questions
Why does my JSON fail with "Unexpected token"?
Usually a missing or extra comma, a single quote instead of a double quote, or a comment. The error shows the line and column.
Does sorting keys change the meaning?
No - JSON objects are unordered by definition, though some tools care about order. Sort when you want stable diffs.
What is the size limit?
Your browser memory. Several megabytes work fine.