knowledge/technology/files/JSON.md

39 lines
1.5 KiB
Markdown
Raw Normal View History

2023-12-04 10:02:23 +00:00
---
website: https://www.json.org
2024-03-06 12:15:41 +00:00
obj: format
extension: "json"
mime: "application/json"
2023-12-04 10:02:23 +00:00
---
# 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.
2023-12-07 02:30:58 +00:00
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).
2023-12-04 10:02:23 +00:00
## 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.