What are the rules of JSON syntax?
Usage & Getting Started
JSON has a small, strict set of syntax rules. Data is built from objects ({ }) and arrays ([ ]); keys must be double-quoted strings; and values can only be a string, number, true, false, null, object, or array.
Valid JSON
{
"id": 1042,
"title": "Hello",
"tags": ["a", "b"],
"published": true,
"meta": null
}
The rules
- Keys and string values use double quotes, not single quotes
- Separate key-value pairs and array items with commas, but no trailing comma after the last one
- Numbers are written plainly (
42,3.14,-1e5) with no quotes - Use the literals
true,false, andnull(lowercase) - Comments are not allowed in standard JSON
Common mistakes
- Trailing comma:
[1, 2, 3,] - Single quotes:
{ 'name': 'Ada' } - Unquoted keys:
{ name: "Ada" } - Adding comments:
// like this
Not sure if your JSON is valid? Paste it into the JSON validator. It flags the exact line and reason for any error as you type. Learn more in fixing validation errors.
Still Have Questions?
Check out our other FAQ topics or return to the JSON Copilot app