ECMA-404

翻译仅供参考,请以原文为准

介绍 Introduction

​ JSON 是一种文本数据交换格式,语法由大括号、方括号、冒号和逗号组成,用于很多上下文、配置文件和应用程序中。JSON 受到 JavaScript 的对象表示启发,它不会尝试将 JS 的内部数据表示强加于其他语言,而是共享文本表示的一部分。

​ JSON 不关心数字的实现。在不同的编程语言中会有各种长度和补码、整型或浮点型、二进制或十进制的不同数字类型。这使得不同编程语言之间的数据交换很困难。相反,JSON 只提供人们使用的数字表示:数字序列。所有的编程语言都可以解析数字序列,即使它们内部对于数字的实现不同。这对于数据交换已经足够了。

​ JSON 文本是一系列 Unicode 码点。JSON 也依赖 \u 转义符中的 Unicode 十六进制表示。

​ 不同编程语言在是否支持对象以及若支持对象对于对象的特征和约束方面存在很大差异。对象系统的模型已经大相径庭而且还将变得更加不同。相反,JSON 提供了一些简单的符号来表示键值对。大多数编程语言都有一些表示这样集合的特性,这些特性可能被命名为 record, struct, diet, map, hash, object。

​ JSON 也支持有序列表。所有的编程语言都有一些特性来表示这样的列表,这些特性可能被命名为 array, vector, list。因为对象和数组可以嵌套,所以可以表示树和其他复杂的数据结构。通过接受 JSON 的简单约定,复杂的数据结构可以很容易的在不兼容编程语言之间转换。

​ JSON 不支持,至少不直接支持循环引用。JSON 同样不适用于需要二进制数据的应用。

​ 预计将会有其他基于此标准的,严格遵守 JSON 格式同时提供了各种编码细节限制的标准。这些标准可能需要特定的的行为。JSON 本身并没有指定任何行为。

​ 因为它很简单,所以预计 JSON 的语法将永远不会改变。这给了 JSON 作为基础表示极大的稳定性。JSON 作为 JS 对象简谱于 2001 年在 JSON.org 首次向世界展示。

JSON is a text format that facilitates structured data interchange between all programming languages. JSON is syntax of braces, brackets, colons, and commas that is useful in many contexts, profiles, and applications. JSON was inspired by the object literals of JavaScript aka ECMAScript as defined in the ECMAScript Language Specification, third Edition [1]. It does not attempt to impose ECMAScript’s internal data representations on other programming languages. Instead, it shares a small subset of ECMAScript’s textual representations with all other programming languages.

JSON is agnostic about numbers. In any programming language, there can be a variety of number types of various capacities and complements, fixed or floating, binary or decimal. That can make interchange between different programming languages difficult. JSON instead offers only the representation of numbers that humans use: a sequence of digits. All programming languages know how to make sense of digit sequences even if they disagree on internal representations. That is enough to allow interchange.

JSON text is a sequence of Unicode code points. JSON also depends on Unicode in the hex numbers used in the \u escapement notation.

Programming languages vary widely on whether they support objects, and if so, what characteristics and constraints the objects offer. The models of object systems can be wildly divergent and are continuing to evolve. JSON instead provides a simple notation for expressing collections of name/value pairs. Most programming languages will have some feature for representing such collections, which can go by names like record, struct, diet, map, hash, or object.

JSON also provides support for ordered lists of values. All programming languages will have some feature for representing such lists, which can go by names like array, vector, or list. Because objects and arrays can nest, trees and other complex data structures can be represented. By accepting JSON’s simple convention, complex data structures can be easily interchanged between incompatible programming languages.

JSON does not support cyclic graphs, at least not directly. JSON is not indicated for applications requiring binary data.

It is expected that other standards will refer to this one, strictly adhering to the JSON text format, while imposing restrictions on various encoding details. Such standards may require specific behaviours. JSON itself specifies no behaviour.

Because it is so simple, it is not expected that the JSON grammar will ever change. This gives JSON, as a foundational notation, tremendous stability. JSON was first presented to the world at the JSON.org website in 2001. JSON stands for JavaScript Object Notation.

JSON 数据交换格式 The JSON Data Interchange Format

1. 范围 Scope

​ JSON 是一种轻量级的、基于文本的、与语言无关的数据交换格式。它源自 ECMAScript 编程语言,但独立于编程语言。JSON 为结构化数据的可移植表示定义了一小组结构化规则。

JSON is a lightweight, text-based, language-independent data interchange format. It was derived from the ECMAScript programming language, but is programming language independent. JSON defines a small set of structuring rules for the portable representation of structured data.

2. 一致性 Conformance

​ JSON 文本是严格符合 JSON 语法的 Unicode 码点序列。

Conforming JSON text is a sequence of Unicode code points that strictly conforms to the JSON grammar.

3. 引用标准 Normative references

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

ISO/IEC 10646:2012*, Information Technology – Universal Coded Character Set (UCS)*

The Unicode Consortium. The Unicode Standard, Version 6.2.0, (Mountain View, CA: The Unicode Consortium, 2012. ISBN 978-1-936213-07-8)

http://www.unicode.org/versions/Unicode6.2.0/.

4. JSON 文本 JSON Text

​ JSON 文本是由符合 JSON 语法的 Unicode 码点组成的标记(token)序列。标记集合包括六个结构标记、字符串、数字和三个字面常量标记。

​ 六个结构标记:

  • [ U+005B 左中括号
  • { U+007B 左大括号
  • ] U+005D 右中括号
  • } U+007D 右大括号
  • : U+003A 冒号
  • , U+002C 逗号

​ 三个字面常量标记

  • true U+0074 U+0072 U+0075 U+0065
  • false U+0066 U+0061 U+006c U+0073 U+0065
  • null U+006E U+0075 U+006C U+006C

在任何标记之间或之后都允许使用无关紧要的空白字符,这些空白字符有制表符 (U+000A)、换行符 (U+000A)、回车符 (U+000D) 和空格符 (U+0020)。除了字符串外,其他任何标记内都不允许使用空白字符。

A JSON text is a sequence of tokens formed from Unicode code points that conforms to the JSON value grammar. The set of tokens includes six structural tokens, strings, numbers, and three literal name tokens.

The six structural tokens:

  • [ U+005B left square bracke
  • { U+007B left curly bracket
  • ] U+005D right square bracket
  • } U+007D right curly bracket
  • : U+003A colon
  • , U+002C comma

These are three literal name tokens:

  • true U+0074 U+0072 U+0075 U+0065
  • false U+0066 U+0061 U+006c U+0073 U+0065
  • null U+006E U+0075 U+006C U+006C

Insignificant whitespace is allowed before or after any token. The whitespace characters are: character tabulation (U+0009), line feed (U+000A), carriage return (U+000D), and space (U+0020). Whitespace is not allowed within any token, except that space is allowed in strings.

5. JSON 值 JSON Values

​ JSON 的值可以是对象 (object),列表 (array),数字 (number),字符串 (string),truefalsenull

A JSON value can be an object, array, number, string, true, false, or null.

6. 对象 Objects

​ 对象结构表示为一对包含零个或多个键值对的大括号标记。键为一个字符串。每个键后面都有一个冒号标记,将键和值分开。不同键值对之间以逗号标记分隔。

An object structure is represented as a pair of curly bracket tokens surrounding zero or more name/value pairs. A name is a string. A single colon token follows each name, separating the name from the value. A single comma token separates a value from a following name.

7. 列表 Arrays

​ 数组结构是一对围绕零个或多个值的中括号标记。这些值以逗号分隔。值的顺序是重要的。

An array structure is a pair of square bracket tokens surrounding zero or more values. The values are separated by commas. The order of the values is significant.

8.数字 Numbers

​ 一个十进制没有前导零的十进制数。它可能有一个负号 (U+002D) 前缀。它可能有一个以小数点 (U+002E) 作为前缀的小数位。它可能有一个以十为底数前缀为 e (U+0065) 或 E (U+0045) 前缀后可选择正号 () 或负号 () 的指数位。数字的码点为 U+0030 到 U+0039。

​ 不能使用不能表示为数字序列的数值,例如无穷大 Infinity 或 NaN。

A number is represented in base 10 with no superfluous leading zero. It may have a preceding minus sign (U+002D). It may have a . (U+002E) prefixed fractional part. It may have an exponent of ten, prefixed by e(U+0065) or E (U+0045) and optionally + (U+002B) or – (U+002D). The digits are the code points U+0030 through U+0039.

Numeric values that cannot be represented as sequences of digits (such as Infinity and NaN) are not permitted.

9. 字符串 String

​ 字符串是用引号 (U+005C) 包裹的 Unicode 码点序列。除去必须转义的字符包括引号 (U+0022)、反斜杠 (U+005C) 和 U+0000 到 U+001F 的控制字符外,所有字符都可以放在引号内。某些字符由两个字符的转义序列表示。

转义序列 对应字符 字符的码点
\" 引号 U+0022
\\ 反斜杠 U+005C
\/ 斜杠 U+002F
\b 退格符 U+0008
\f 换页符 U+000C
\n 换行符 U+000A
\r 回车符 U+000D
\t 制表符 U+0009

​ 因此,例如,仅包含一个反斜杠的字符串可以表示为“\\”。

​ 任何码点都可以表示为一个十六进制数。这样的一个数字的意义是明确的。根据 ISO/IEC 10646 ,若码点位于基本多文种平面 (U+0000 到 U+FFFF) ,那么它可能表示已一个六个字符的序列:反斜线,后跟小写字母 u,然后是编码码点的四个十六进制数字。十六进制数字可以是数字 (U+0030 到 U+0039) 或大写的十六进制字母 A 到 F (U+0041 到 U+0046) 或小写 (U+0061 到 U+0066)。因此,例如,仅包含一个反斜杠的字符串可以表示为 “\u005C”。

​ 下述的四个表达式结果是相同的:“\u002F”、“\u002f”、“/”、“/”。

​ 为了转义不在基本多文种平面的码点,字符被表示为一个十二个字符的序列来编码 UTF-16 代理对。例如,一个只包含 G 谱号 (

JSON 标准 ECMA-404相关推荐

  1. python json库函数_python基础之JSON标准库

    一.序列化的一些简单概念 我们平常使用的python对象所进行的操作是在内存中,当程序关闭就会被清空,所以我们需要用一种合适的方法将这些数据保存下来. 为了将我们的数据进行永久存储,需要引入序列化(p ...

  2. 沪深A股指数历史分时交易数据API接口(JSON标准格式,Get请求方式)

    沪深A股指数历史分时交易数据API接口(JSON标准格式,Get请求方式) 数据来源:沪深A股股票数据API接口 麦蕊智数(www.mairui.club) 历史分时交易 ·  API接口:http: ...

  3. A股涨跌股池数据API接口(JSON标准格式,Get请求方式)

    A股涨跌股池数据API接口(JSON标准格式,Get请求方式) 数据来源:麦蕊智数(www.mairui.club) 涨停股池 ·  API接口:http://api.mairui.club/hslt ...

  4. 沪深A股分析数据龙虎榜信息API接口(JSON标准格式,Get请求方式)

    沪深A股分析数据龙虎榜信息API接口(JSON标准格式,Get请求方式) 数据来源:沪深A股股票数据API接口 麦蕊智数(www.mairui.club) 每日详情 ·  API接口:http://a ...

  5. 沪深A股分析数据投资参考信息API接口(JSON标准格式,Get请求方式)

    沪深A股分析数据投资参考信息API接口(JSON标准格式,Get请求方式) 数据来源:沪深A股股票数据API接口 麦蕊智数(www.mairui.club) 今日交易提示 ·  API接口:http: ...

  6. A股股票列表数据API接口(JSON标准格式,Get请求方式)

    数据来源:麦蕊智数(www.mairui.club) 沪深两市股票 ·  API接口:http://api.mairui.club/hslt/list/您的licence ·  备用接口:http:/ ...

  7. 沪深A股分析数据财务分析信息API接口(JSON标准格式,Get请求方式)

    数据来源:沪深A股股票数据API接口 麦蕊智数(www.mairui.club) 盈利能力 ·  API接口:http://api.mairui.club/hicw/yl/年度(如2020)/季度(如 ...

  8. 沪深A股分析数据机构持股信息API接口(JSON标准格式,Get请求方式)

    数据来源:麦蕊智数(www.mairui.club) 机构持股汇总 ·  API接口:http://api.mairui.club/hijg/jgcghz/年度(如2020)/季度(如1)/您的lic ...

  9. A股指数、行业、概念列表数据API接口(JSON标准格式,Get请求方式)

    数据来源:麦蕊智数(www.mairui.club) 指数.行业.概念 ·  API接口:http://api.mairui.club/hszg/list/您的licence ·  备用接口:http ...

  10. 沪深A股指数最新分时交易数据API接口(JSON标准格式,Get请求方式)

    数据来源:沪深A股股票数据API接口 麦蕊智数(www.mairui.club) 最新分时交易 ·  API接口:http://api.mairui.club/zs/fsjy/指数代码(如sh0000 ...

最新文章

  1. cad无法加载arx文件_多年经验总结CAD技巧8
  2. 大话数据结构03:静态链表
  3. 线性表-----队列
  4. 2-jQuery - AJAX load() 方法【进阶篇】
  5. linux 内核字符驱动char_dev源码分析
  6. qt connect函数_Qt官方示例广播发送器
  7. kettle的变量空间接口VariableSpace实现与委托模式
  8. 数据结构括号匹配代码_数据结构中的栈,你知道多少?
  9. Android Native Hook工具
  10. 蓝桥杯2020年第十一届Python省赛第五题-排序
  11. ubuntu 11.10 因为gcc版本过高引起的错误,安装 gcc 4.4(转)
  12. Codeforce432 Prime Swaps
  13. 一波三折,终于找到src漏洞挖掘的方法了【建议收藏】
  14. 【笔记】运筹(中)——Rita_Aloha
  15. Linux printf Class.this git rebase Persistent Bugger
  16. 网络攻防技术-Lab5-shellcode编写实验(SEED Labs – Shellcode Development Lab)
  17. iOS程序拨打电话方法
  18. OC作业- 图书馆管理系统
  19. 往日学习=【iptables实验part3-搭建简单蜜罐网络】
  20. 【C语言】(百合花)水仙花数的算法思考习题4-6 水仙花数

热门文章

  1. react-router v6替换history.goBack()和goForward()
  2. 销售订单创建BAPI实例(刘欣)
  3. 【经验】使用WPS的公式编辑器时,弹出提示“MT Extra 字体无效,请重新安装”
  4. 易到要在网约车市场突围并不容易
  5. Global Sensing and Measurements Reuse for Image Compressed Sensing
  6. Microsoft SQL Server 2000的版本区别及选择
  7. axis webservice 实验
  8. 九州8508机顶盒安装软件教程记录
  9. Nuvoton M0518 之 记录数据到LDROM,数据掉电不丢失的方式
  10. linux终端联网网速慢,解决ubuntu 上网速度慢的问题