JSON Syntax
Learn the rules and structure of JSON: objects, arrays, data types, and formatting. This page covers everything you need to know to write valid JSON.
Basic Structure
JSON is built on two structures:
- Objects: Unordered collections of key-value pairs
- Arrays: Ordered sequences of values
Data Types
Strings
Double-quoted text:
"Hello, World!"
Numbers
Integer or floating-point:
42
3.14
Booleans
true or false:
true
false
Null
Represents empty value:
null
Objects
{
"name": "John",
"age": 30,
"isActive": true
}
Arrays
["apple", "banana", "orange"]
Nested Structures
{
"person": {
"name": "John",
"hobbies": ["reading", "gaming"]
}
}
Rules
- Use double quotes for strings
- No trailing commas
- No comments
- No functions or expressions
- Keys must be strings