Sobes.tech
Intern

What is JSON?

sobes.tech AI

Answer from AI

JSON (JavaScript Object Notation) is a lightweight text data interchange format. It is based on a subset of the JavaScript language but is completely independent of it.

Main features of JSON:

  • Readability: Human-readable format.
  • Simplicity: Easy to parse and generate.
  • Independence: Supported by most programming languages.

JSON represents data as key-value pairs or ordered lists of values.

Supported data types in JSON:

  • Objects: Unordered collections of key-value pairs. Keys are strings, values are any valid JSON types.
  • Arrays: Ordered lists of values. Values are any valid JSON types.
  • Strings: Unicode character sequences enclosed in double quotes.
  • Numbers: Integers or floating-point numbers.
  • Boolean values: true or false.
  • Null: Empty value.

Example:

// Example of a JSON object
{
  "name": "Ivan",
  "age": 30,
  "isStudent": false,
  "courses": ["Mathematics", "Physics"],
  "address": {
    "city": "Moscow",
    "zipCode": "100001"
  },
  "notes": null
}

JSON is widely used for:

  • Data transfer between client and server (API).
  • Configuration files.
  • Data storage.