JSON (JavaScript Object Notation)
A lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate.
JSON (JavaScript Object Notation) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute-value pairs and arrays.
Despite its name and origin in JavaScript, JSON is language-independent. Most modern programming languages include code to generate and parse JSON-format data.
Syntax Rules
Data in JSON is organized in two structures:
- A collection of name/value pairs: In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
- An ordered list of values: In most languages, this is realized as an array, vector, list, or sequence.
A JSON object is enclosed in curly braces {} and contains key-value pairs separated by commas. Keys must be strings enclosed in double quotes "".
{
"firstName": "John",
"lastName": "Doe",
"age": 30,
"isEmployee": true,
"skills": ["JavaScript", "HTML", "CSS"],
"address": {
"street": "123 Main St",
"city": "Anytown"
}
}
Data Types
JSON supports the following basic data types:
- String: A sequence of zero or more Unicode characters enclosed in double quotes.
- Number: An integer or a floating-point number.
- Boolean:
trueorfalse. - Null: An empty value, represented by the word
null. - Object: An unordered collection of key-value pairs.
- Array: An ordered sequence of values.
Try the Tools
DevFlow provides free, privacy-first tools related to JSON (JavaScript Object Notation). They run completely in your browser.