39 lines
No EOL
1.5 KiB
Markdown
39 lines
No EOL
1.5 KiB
Markdown
---
|
|
website: https://www.json.org
|
|
obj: format
|
|
extension: "json"
|
|
mime: "application/json"
|
|
---
|
|
|
|
# JSON
|
|
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is often used for exchanging data between a web server and a web application, as well as between different programming languages.
|
|
|
|
JSON is commonly used in web development to transfer data between a web server and a web application. For example, when a web application makes a request to a web server, the server might respond with a JSON object or array containing the requested data.
|
|
|
|
Some technologies have been built on top of JSON like [JWT](../internet/JWT.md), [JSONPatch](../tools/JSONPatch.md) or [JSON Schema](../tools/JSON%20Schema.md).
|
|
|
|
## JSON Syntax
|
|
|
|
JSON is built on two structures: objects and arrays. An object is an unordered set of key/value pairs, while an array is an ordered collection of values.
|
|
|
|
Here is an example of a JSON object:
|
|
```json
|
|
{
|
|
"name": "John",
|
|
"age": 30,
|
|
"city": "New York"
|
|
}
|
|
```
|
|
|
|
In this example, "name", "age", and "city" are keys, and "John", 30, and "New York" are values. The keys and values are separated by a colon, and each key/value pair is separated by a comma. The entire object is enclosed in curly braces.
|
|
|
|
Here is an example of a JSON array:
|
|
```json
|
|
[
|
|
"apple",
|
|
"banana",
|
|
"orange"
|
|
]
|
|
```
|
|
|
|
In this example, "apple", "banana", and "orange" are values. The values are separated by commas, and the entire array is enclosed in square brackets. |