knowledge/technology/files/JSON.md
2023-12-04 11:02:23 +01:00

1.3 KiB

website obj
https://www.json.org concept

JSON

#refactor
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.

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:

{
  "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:

[
  "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.