🍋
Menu
Web

JSON

JSON (JavaScript Object Notation)

A lightweight, text-based data interchange format that uses human-readable key-value pairs and ordered lists to represent structured data, serving as the standard format for web APIs and configuration files.

技術的詳細

JSON (RFC 8259) supports six data types: string (double-quoted Unicode), number (integer or floating-point), boolean (true/false), null, object (unordered key-value map), and array (ordered list). It does not support comments, trailing commas, single quotes, undefined, dates, or binary data natively. JSON5 and JSONC extend the format with comments and relaxed syntax. Parsing is handled by JSON.parse() in JavaScript and equivalent standard library functions in every major language. Streaming parsers (SAX-style) handle files too large to fit in memory.

```javascript
// JSON parse with reviver function
const data = JSON.parse(text, (key, val) => {
  if (key === 'date') return new Date(val);
  return val;
});

// JSON stringify with replacer and indentation
JSON.stringify(data, ['name', 'email'], 2);
```

関連フォーマット

関連ツール

関連用語