JSON (JavaScript Object Notation) has a straightforward but strict structure that makes it reliable for data exchange. At its core, JSON works with just a few building blocks: objects, arrays, strings, numbers, booleans, and null values. Objects are wrapped in curly braces and contain key-value pairs, while arrays use square brackets [] to hold ordered lists of values.
What many developers don't realize is how specific the rules are for each element. Keys must always be strings wrapped in double quotes—single quotes won't work. String values also need double quotes, and this includes empty strings. Numbers can be integers, decimals, or use exponential notation, but special values like NaN or Infinity aren't valid in standard JSON.
Valid vs Invalid Examples:
{
"name": "John",
"age": 30,
"active": true
}{
name: 'John', // No quotes on key
age: 30,
active: true, // Trailing comma
}The nesting depth matters too—while you can nest objects and arrays deeply, most parsers have limits (typically around 50-100 levels). Our tool checks for reasonable nesting to prevent stack overflow errors. Understanding these structural rules helps you create JSON that works everywhere, from web APIs to configuration files and data storage.