JSON
JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy to read and write for humans and simple for machines to parse and generate. It represents data as key-value pairs and arrays.
Also known as: JSON format.
Comparisons
- JSON vs. XML: JSON is more concise and easier to read than XML.
- JSON vs. CSV: JSON supports hierarchical data, while CSV is limited to tabular formats.
Pros
- Human-readable: Easy to understand and debug.
- Flexible: Supports complex nested structures.
- Universally compatible: Used across multiple programming languages.
Cons
- Verbose: Can be larger in size compared to binary formats.
- Lack of schema validation: Does not inherently enforce data types or structure.
Example
When a weather app fetches data from an API, the response often includes JSON-formatted information, such as the current temperature, humidity levels, and forecast details organized into categories for easy processing.