JSON
一句话解释
JSON (JavaScript 对象 Notation) 是 lightweight 文本格式 for 存储 and exchanging structured 数据.
用大白话说
JSON is a text-based data format that is easy for humans to read and for machines to parse. It is the standard data format for web APIs, replacing XML for most use cases. Despite the name, JSON is language-independent — it works with any programming language.
JSON has a simple structure: objects (key-value pairs in curly braces) and arrays (ordered lists in square brackets). Values can be strings (double-quoted), numbers, booleans, null, objects, or arrays. JSON does NOT support undefined, functions, or comments.
In JavaScript, you convert with JSON.stringify(obj) (object → JSON string) and JSON.parse(str) (JSON string → object). All keys must be double-quoted, and strings must use double quotes — single quotes are invalid in JSON.
示例
{
"name": "Ada Lovelace",
"age": 36,
"skills": ["math", "programming"],
"active": true,
"mentor": null
}JSON 对象使用字符串, 数字, 数组, 布尔值, and 空值. 所有键 是双-quoted.
相关术语
相关资源
相关课程
- JSON
学习 JSON.
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。