>_
smartdevbox
Try SmartDevBox free — no sign-up91+ tools · 100% client-side · no account required
Glossary

What Is JSON?

JSON (JavaScript Object Notation) is a lightweight, human-readable text format for representing structured data as key-value pairs, arrays, and nested objects. Despite the name, it is entirely language-independent and is the dominant data format for REST APIs, configuration files, and data storage across all modern programming languages.

The One-Line Definition

JSON is a text-based data interchange format defined by RFC 8259 (ECMA-404). It represents structured data using six value types: strings, numbers, booleans, null, objects, and arrays.

A JSON Example

{
  "user": {
    "id": 42,
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "active": true,
    "roles": ["admin", "editor"],
    "metadata": null
  }
}

JSON Data Types

JSON supports exactly six value types — no more, no less:

TypeExampleNotes
string"Hello, world!"Must use double quotes. Supports Unicode escape sequences (\uXXXX).
number42 / 3.14 / -7 / 1e10Integer or floating-point. No leading zeros, no NaN, no Infinity.
booleantrue / falseLowercase only. Not "True" or 1/0.
nullnullRepresents an absent or unknown value. Lowercase only.
object{"key": "value"}Unordered set of key-value pairs. Keys must be strings (double-quoted).
array[1, "two", true, null]Ordered list of any JSON values (mixed types are allowed).

Common JSON Syntax Errors

Because JSON is strict about syntax, small mistakes cause the entire document to fail to parse. These are the errors developers encounter most often:

Trailing commaInvalid: {"a": 1, "b": 2,}
Fix: Remove the comma after the last item. JSON (unlike JavaScript) does not allow trailing commas.
Single-quoted stringInvalid: {"a": 'hello'}
Fix: Use double quotes: {"a": "hello"}
Unquoted keyInvalid: {a: 1}
Fix: Keys must be double-quoted strings: {"a": 1}
CommentInvalid: {"a": 1 // comment}
Fix: JSON has no comment syntax. Remove comments before parsing.
undefined valueInvalid: {"a": undefined}
Fix: JSON has no undefined type. Use null, omit the key, or encode as a string.
Leading zero in numberInvalid: {"a": 007}
Fix: Leading zeros are invalid. Use 7 instead of 007.

JSON vs XML

JSON — compact, readableNo closing tags. Maps directly to objects and arrays in code. Smaller payload size. Dominant format for REST APIs. No support for attributes, namespaces, or comments.
XML — expressive, verboseSupports attributes, namespaces, comments, and mixed content. Used in SOAP services, SVG, HTML, and configuration files (pom.xml, web.xml). Larger payload for the same data.

Format or Validate JSON Now

Paste any JSON into SmartDevBox and it is auto-detected, formatted, and validated instantly — no button click. If there is a syntax error, the exact line and column number is reported. Open the JSON Formatter → or JSON Validator →

Frequently Asked Questions

What are the JSON data types?

Six: string (double-quoted), number, boolean (true/false), null, object ({key: value}), and array ([...]). There is no date, undefined, or function type in JSON.

What is the difference between JSON and XML?

JSON is more compact and maps directly to language data structures. XML supports attributes, namespaces, and comments, making it more expressive but more verbose. JSON dominates REST APIs; XML is common in SOAP and configuration files.

Can JSON have comments?

No. Standard JSON (RFC 8259) has no comment syntax. The JSON5 and JSONC formats add comment support but are not valid JSON.

How do I format and validate JSON online?

Paste your JSON into SmartDevBox. It auto-detects JSON input and pretty-prints it immediately. Syntax errors are reported with line and column numbers. 100% client-side — your data never leaves the browser.

What Is Base64 Encoding?Binary data embedded in JSON (images, certificates) is typically Base64-encoded.
What Is a JWT?JWT payloads are JSON objects encoded as Base64url strings.
JSON FormatterAuto-detects and pretty-prints JSON with configurable indentation.
JSON to CSV ConverterConvert a JSON array of objects to CSV with one paste.