Skip to main content

1. Introduction (简介)

JavaScript Object Notation (JSON) is a text format for the serialization of structured data. It is derived from the object literals of JavaScript, as defined in the ECMAScript Programming Language Standard, Third Edition [ECMA-262].

JavaScript对象表示法(JSON)是一种用于结构化数据序列化的文本格式。它源自JavaScript的对象字面量,如ECMAScript编程语言标准第三版[ECMA-262]中所定义。

JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays).

JSON可以表示四种基本类型(字符串、数字、布尔值和null)和两种结构化类型(对象和数组)。

A string is a sequence of zero or more Unicode characters [UNICODE]. Note that this citation references the latest version of Unicode rather than a specific release. It is not expected that future changes in the UNICODE specification will impact the syntax of JSON.

字符串是零个或多个Unicode字符[UNICODE]的序列。注意,此引用指向Unicode的最新版本而不是特定版本。预计Unicode规范的未来变更不会影响JSON的语法。

An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.

对象是零个或多个名称/值对的无序集合,其中名称是字符串,值可以是字符串、数字、布尔值、null、对象或数组。

An array is an ordered sequence of zero or more values.

数组是零个或多个值的有序序列。

The terms "object" and "array" come from the conventions of JavaScript.

术语"对象(object)"和"数组(array)"来自JavaScript的约定。

JSON's design goals were for it to be minimal, portable, textual, and a subset of JavaScript.

JSON的设计目标是最小化、可移植、文本化,并且是JavaScript的子集。

1.1. Conventions Used in This Document (本文档使用的约定)

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

本文档中的关键字"MUST(必须)"、"MUST NOT(不得)"、"REQUIRED(要求)"、"SHALL(应)"、"SHALL NOT(不应)"、"SHOULD(应该)"、"SHOULD NOT(不应该)"、"RECOMMENDED(推荐)"、"MAY(可以)"和"OPTIONAL(可选)"按照[RFC2119]中的描述进行解释。

The grammatical rules in this document are to be interpreted as described in [RFC5234].

本文档中的语法规则按照[RFC5234]中的描述进行解释。

1.2. Specifications of JSON (JSON的规范)

This document updates [RFC4627], which describes JSON and registers the media type "application/json".

本文档更新了[RFC4627],该文档描述了JSON并注册了媒体类型"application/json"。

A description of JSON in ECMAScript terms appears in Version 5.1 of the ECMAScript specification [ECMA-262], Section 15.12. JSON is also described in [ECMA-404].

在ECMAScript规范[ECMA-262]版本5.1的第15.12节中,以ECMAScript术语描述了JSON。JSON也在[ECMA-404]中进行了描述。

All of the specifications of JSON syntax agree on the syntactic elements of the language.

所有JSON语法规范在该语言的语法元素上达成了一致。

1.3. Introduction to This Revision (本修订版简介)

In the years since the publication of RFC 4627, JSON has found very wide use. This experience has revealed certain patterns, which, while allowed by its specifications, have caused interoperability problems.

自RFC 4627发布以来的这些年里,JSON得到了非常广泛的使用。这一经验揭示了某些模式,虽然这些模式在规范中是允许的,但却导致了互操作性问题。

Also, a small number of errata have been reported (see RFC Errata IDs 607 [Err607] and 3607 [Err3607]).

此外,还报告了少量勘误(参见RFC勘误ID 607 [Err607]和3607 [Err3607])。

This document's goal is to apply the errata, remove inconsistencies with other specifications of JSON, and highlight practices that can lead to interoperability problems.

本文档的目标是应用勘误,消除与JSON其他规范的不一致性,并强调可能导致互操作性问题的做法。