Skip to content

This file type cannot be converted in the browser.

┌─ FILE ANALYSIS ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
DEVELOPER : Douglas Crockford
CATEGORY : Code
MIME TYPE : application/json
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

What is a JSON file?

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. Douglas Crockford standardized it in the early 2000s, deriving it from JavaScript object literal syntax. It uses human-readable key-value pairs and arrays, making it the dominant format for web APIs, configuration files, and data exchange between applications across virtually every programming language.

JSON replaced XML as the standard API format because it is less verbose, easier to parse, and maps directly to native data structures in most languages. Every major REST API and many GraphQL implementations return JSON.

How to open JSON files

  • Any text editor — Notepad, TextEdit, VS Code
  • VS Code (Windows, macOS, Linux) — Formatting, validation, IntelliSense for JSON Schema
  • Any web browser — Built-in JSON viewer (Firefox has the best native formatter)
  • jq (CLI) — Powerful command-line JSON processor and query tool
  • JSON Viewer (browser extension) — Pretty-prints raw JSON responses

Technical specifications

PropertyValue
EncodingUTF-8 (required by RFC 8259)
Data TypesString, Number, Boolean, Null, Object, Array
CommentsNot supported (use JSONC for comments)
StandardECMA-404, RFC 8259
SchemaJSON Schema (jsonschema.org) for validation
MIME typeapplication/json

Common use cases

  • Web APIs: REST and GraphQL response bodies
  • Configuration files: package.json, tsconfig.json, vercel.json, .eslintrc.json
  • Data storage: NoSQL databases (MongoDB, CouchDB, Firestore) store documents as JSON
  • Data exchange: Cross-platform data interchange between services
  • Localization: Translation strings in i18n frameworks

JSON structure example

{
  "name": "FileDex",
  "version": "1.0.0",
  "features": ["search", "convert", "multilingual"],
  "config": {
    "maxFileSize": 104857600,
    "supportedLocales": ["en", "ar"]
  },
  "active": true,
  "rating": null
}

JSON supports exactly six value types: strings (always double-quoted), numbers, booleans (true/false), null, objects ({}), and arrays ([]). Single quotes are invalid JSON.

JSON vs alternatives

FormatProsCons
JSONUniversal, simple, fast parsersNo comments, verbose for binary
JSONCJSON + comments (VS Code uses this)Non-standard
YAMLComments, less verboseWhitespace-sensitive, parsing edge cases
TOMLComments, typed, readableLess universal library support
MessagePackBinary JSON (smaller, faster)Not human-readable

Parsing and validation

In JavaScript: JSON.parse(string) and JSON.stringify(object) are built-in. Most other languages have equivalent standard-library functions. Invalid JSON causes parse errors — common mistakes include trailing commas, single-quoted strings, and unquoted keys. Use a JSON linter or validator (jsonlint.com) to diagnose syntax errors. JSON Schema lets you validate structure and data types programmatically.

Security considerations

Never use eval() to parse JSON — it executes arbitrary JavaScript. Always use JSON.parse(). When serving user-generated data as JSON in an API, ensure the response includes the Content-Type: application/json header to prevent MIME-sniffing attacks. Avoid embedding sensitive data in JSON responses that are cached by CDNs or browsers.