JSON File Format (JavaScript Object Notation)
JSON (JavaScript Object Notation) is a lightweight data interchange format that has become the standard for web APIs, configuration files, and data storage. Created by Douglas Crockford and standardized as ECMA-404 and RFC 8259, JSON uses human-readable text to represent structured data using key-value pairs and ordered lists. JSON syntax is derived from JavaScript object literals but is language-independent, with parsers available in virtually every programming language. JSON replaced XML as the dominant format for web APIs and REST services because of its simplicity, readability, and smaller payload sizes. The format supports strings, numbers, booleans, null, arrays, and nested objects.
Quick Facts
- Extension: .json
- MIME Type: application/json
- Category: document
Advantages
- Human-readable and easy to understand
- Universal support in all programming languages
- Lightweight with minimal syntax overhead
- Native support in web browsers (JSON.parse/stringify)
- Supports hierarchical and nested data structures
Disadvantages
- No support for comments
- No date/time data type (dates stored as strings)
- Large files can be slow to parse
- No schema enforcement in the format itself
- Trailing commas and single quotes are syntax errors
Common Use Cases
- REST API request and response payloads
- Application configuration files
- NoSQL database storage (MongoDB, CouchDB)
- Data exchange between frontend and backend
- Package manifests (package.json, composer.json)
Technical Details
JSON syntax has six structural characters: { } [ ] : , and six value types. Objects are unordered collections of key-value pairs enclosed in braces. Arrays are ordered lists enclosed in brackets. Strings use double quotes and support Unicode escape sequences (\uXXXX). Numbers follow IEEE 754 double-precision format. JSON does not support circular references, binary data, or undefined values. Parsing JSON is strictly defined: a conforming parser must reject malformed input. JSONL (JSON Lines) stores one JSON object per line for streaming processing. JSON5 and JSONC are supersets that add comments and trailing commas.
Frequently Asked Questions about JSON
What is JSON used for?
JSON is the standard format for web API data exchange, configuration files, and structured data storage. Most web applications use JSON to communicate between the browser (frontend) and server (backend).
How do I convert JSON to CSV?
FileChange flattens JSON objects into tabular rows and exports as CSV. Nested objects are flattened using dot notation in column headers.
Can JSON contain comments?
No. Standard JSON does not allow comments. JSONC (JSON with Comments) and JSON5 are unofficial extensions that add comment support, used by VS Code settings and some configuration systems.
Is JSON better than XML?
For web APIs, JSON is preferred because it is more compact, easier to read, and faster to parse. XML is better for document markup, XSLT transformations, and schemas with mixed content.
How do I validate JSON?
Use JSON.parse() in JavaScript, online validators, or JSON Schema for structural validation. Malformed JSON (missing quotes, trailing commas) will cause parsing errors.