JSON(JavaScript 对象表示法)
JSON 是一种轻量级数据交换格式,人类易于读写,机器易于解析和生成。它是现代应用中 Web API、配置文件和数据存储的主流格式。
MIME 类型
application/json
类型
文本
压缩
无损
优点
- + Human-readable and writable with minimal syntax
- + Native parsing in every programming language
- + Dominant format for REST APIs and web services
- + Lightweight — less verbose than XML
缺点
- − No comment syntax — cannot annotate configuration files
- − No native date, binary, or schema types
- − Trailing commas cause parse errors in strict parsers
何时使用 .JSON
在 API 响应、配置文件、服务间数据交换以及任何需要人类可读的结构化数据场景中使用 JSON。
技术细节
JSON 支持六种数据类型:字符串、数字、布尔值、null、数组和对象(键值对映射)。它使用 UTF-8 编码,原生不支持注释、日期或二进制数据。
历史
Douglas Crockford 在 2000 年代初推广了 JSON,它源自 JavaScript 对象字面量语法。JSON 于 2013 年标准化为 ECMA-404,2017 年标准化为 RFC 8259,成为通用的 API 数据格式。
从 .JSON 转换
转换为 .JSON
相关格式
相关术语
Learn More
File Format Conversion: A Complete Guide
Converting files between formats is a daily task for professionals across every industry. This comprehensive guide covers document, image, audio, …
How to Generate Strong Random Passwords
Password generation requires cryptographic randomness and careful character selection. This guide covers the principles behind strong password generation, entropy calculation, …
JSON vs YAML vs TOML: Choosing a Configuration Format
Configuration files are the backbone of modern applications. JSON, YAML, and TOML each offer different trade-offs between readability, complexity, and …
Meta Tags for SEO: Title, Description, and Open Graph
Meta tags control how your pages appear in search results and social media shares. This guide covers the essential meta …
Text Encoding Explained: UTF-8, ASCII, and Beyond
Text encoding determines how characters are stored as bytes. Understanding UTF-8, ASCII, and other encodings prevents garbled text, mojibake, and …
CSV vs JSON vs XML: Data Exchange Formats Compared
Data exchange formats serve different needs. CSV excels at tabular data, JSON dominates web APIs, and XML powers enterprise integrations. …