Skip to content
LangStop

Glossary

Keyboard Shortcuts

ActionShortcut
Toggle SidebarCtrl+B
Save TabCtrl+S
Close TabAlt+W
Switch to Tab 1Alt+Shift+1
Switch to Tab 2Alt+Shift+2
Switch to Tab 3Alt+Shift+3
Switch to Tab 4Alt+Shift+4
Switch to Tab 5Alt+Shift+5
Switch to Tab 6Alt+Shift+6
Switch to Tab 7Alt+Shift+7
Switch to Tab 8Alt+Shift+8
Switch to Tab 9Alt+Shift+9

Settings

Appearance

Customize the look and feel of the editor and interface.

Editor Theme

The font size used in the code editor.

14px

Space between lines in the editor.

1.6×

Changes apply instantly

What is JSON? — JavaScript Object Notation Explained

Definition

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format that uses human-readable text to store and transmit data objects consisting of attribute-value pairs and arrays. It is language-independent, though it uses conventions familiar to C-family languages including C, C++, C#, Java, JavaScript, Perl, Python, and many others. JSON is commonly used for asynchronous browser-server communication, replacing XML in many web applications.


JSON Syntax Rules

JSON syntax is derived from JavaScript object notation syntax, but the format is text only:

  1. Data is in name/value pairs
  2. Data is separated by commas
  3. Curly braces {} hold objects
  4. Square brackets [] hold arrays
  5. Keys must be double-quoted strings
  6. Values must be one of the supported data types
  7. Trailing commas are not allowed

JSON Data Types

Type Example Description
String "Hello World" Double-quoted Unicode text
Number 42, 3.14, -7 Integer or floating point
Boolean true, false Logical true/false
Null null Empty or non-existent value
Object {"key": "value"} Unordered collection of key/value pairs
Array [1, 2, 3] Ordered list of values

Simple JSON Example

{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true,
  "age": 27,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "office",
      "number": "646 555-4567"
    }
  ],
  "children": [],
  "spouse": null
}

Nested Structures

JSON supports deep nesting, allowing you to represent complex relationships:

{
  "company": {
    "name": "Tech Corp",
    "departments": [
      {
        "name": "Engineering",
        "employees": [
          {"name": "Alice", "role": "Senior Dev"},
          {"name": "Bob", "role": "Junior Dev"}
        ]
      },
      {
        "name": "Design",
        "employees": [
          {"name": "Charlie", "role": "Designer"}
        ]
      }
    ]
  }
}

JSON vs XML

Aspect JSON XML
Syntax Compact, object-like Verbose, tag-based
Data Types Native types All text
Parsing Simple Complex (DOM/SAX)
Browser Support Native Requires parser
Comments Not supported Supported
Attributes Not supported Supported
Use Case APIs, web apps Enterprise, documents

Common JSON Use Cases

Web APIs

JSON is the standard format for REST and GraphQL APIs. Almost every public API returns JSON.

Configuration Files

Many tools and frameworks use JSON for configuration (package.json, tsconfig.json, .eslintrc.json).

NoSQL Databases

MongoDB, CouchDB, and Firebase store data in JSON-like formats (BSON for MongoDB).

Data Storage

JSON is used for serializing structured data in files, local storage, and caches.

Cross-Language Communication

JSON bridges different programming languages in microservice architectures.


LangStop JSON Tools

Related Tools

Try these complementary developer tools: