Technical reference
JSON Cheatsheet
Human-readable config & data format
Getting Started
Basic Object
{
"name": "Jason",
"age": 39,
"married": true,
"children": [
{ "name": "Tom", "age": 9 },
{ "name": "Ava", "age": 7 }
]
}Escape Characters
{
"msg": "Hi,\n\"CheatSheets.zip\"",
"url": "https://cheatsheets.zip"
}Invalid String
{ foo: "bar" } // ❌ invalid — keys must be in double quotesValid Numbers
{
"positive": 12,
"negative": -1,
"fraction": 10.25,
"exponent": 1.0e2,
"zero": 0
}Invalid Number
{ "foo": 0xff } // ❌ Hex is invalid in JSONData Structures
Object
{
"color": "Purple",
"id": "210",
"composition": { "R": 70, "G": 39, "B": 89 }
}Array
[1, 2, 3, 4, 5]Array of Objects
{
"children": [
{ "name": "Jimmy", "age": 15 },
{ "name": "Sammy", "age": 12 }
]
}Object of Arrays
{
"attributes": ["a1", "a2"],
"methods": ["getter", "setter"],
"empty": []
}2D Array
{
"matrix": [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9, 0]
]
}Object of Objects
{
"Mark": { "hr": 65, "avg": 0.278 },
"Sammy": { "hr": 63, "avg": 0.288 }
}Nested Object
{
"Jack": {
"id": 1,
"hobby": ["a", "b"],
"location": { "country": "A", "city": "A-A" }
}
}Access in JavaScript
javascript
Access Object
myObject.name;
myObject["name"];
myObject[0]; // undefinedjavascript
Access Nested Object
myObject.ref.age;
myObject.jsmith[3];javascript
Access Array of Objects
myArray[0];
myArray[1].name;
myArray[3]; // undefinedjavascript
Access Array
myArray[1]; // "Doe"
myArray[5]; // true