What is JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is easy for humans to read and write, and easy for machines to parse and generate. JSON is based on a subset of JavaScript, but it is language-independent and can be used with most programming languages.
JSON Syntax Rules
• Data is in name/value pairs • Data is separated by commas • Curly braces {} hold objects • Square brackets [] hold arrays • String values must be written with double quotes
JSON Data Types
JSON supports the following data types: • String: "Hello World" • Number: 42, 3.14, -10 • Boolean: true, false • Null: null • Object: {"key": "value"} • Array: [1, 2, 3]
JSON Example
{
"name": "John Doe",
"age": 30,
"email": "[email protected]",
"isActive": true,
"hobbies": ["reading", "gaming", "coding"],
"address": {
"city": "New York",
"country": "USA"
}
}Common Use Cases
• API responses and requests • Configuration files • Data storage and transfer • Web application state management • Mobile app data exchange
JSON vs XML
JSON advantages over XML: • More compact and lightweight • Easier to read and write • Faster to parse • Native support in JavaScript • Better for web APIs
Try it now!
Use our free JSON Formatter to validate and beautify your JSON data.
Open JSON Formatter