暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

转译--JSON的介绍

原创 张玉龙 2021-11-12
393

原文地址: https://www.json.org/json-en.html

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages also be based on these structures.

In JSON, they take on these forms:

对象(object)是一组无序的 name/value 对。 对象以 { 左大括号 开始,以 } 右大括号 结束。 每个 name 后面都有 : 冒号,name/value之间以 , 逗号分隔。
image.png

数组(array)是值的有序集合。 数组以 [ 左括号 开始,以 ] 右括号 结束。 多个值由 , 逗号分隔。
image.png

值(value)可以是双引号中的 string、number、true or false or null、an object or an array。 这些结构可以嵌套。
image.png

字符串(string)是零个或多个 Unicode 字符的序列,用双引号("")括起来,使用反斜杠()转义。 一个字符表示为单个字符串。字符串非常类似于 C 或 Java 字符串。
image.png

数字(number)与 C 或 Java 数字非常相似,只是不使用八进制和十六进制格式。
image.png

可以在任何一对标记之间插入空格。
image.png

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论