ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

json_json的定义/definition of json

2022-01-29 00:02:24  阅读:232  来源: 互联网

标签:definition 定义 may JSON strings json any name


Json definition

权威定义

其他资料

json基本特点

JSON is purely a string with a specified data format — it contains only properties, no methods.

JSON requires double quotes to be used around strings and property names.

  • Single quotes are not valid other than surrounding the entire JSON string.

Even a single misplaced comma or colon can cause a JSON file to go wrong, and not work.

  • You should be careful to validate any data you are attempting to use (although computer-generated JSON is less likely to include errors, as long as the generator program is working correctly). You can validate JSON using an application like JSONLint.

JSON can actually take the form of any data type that is valid for inclusion inside JSON, not just arrays or objects.

  • So for example, a single string or number would be valid JSON.(这种情况下用处不大)

Unlike in JavaScript code in which object properties may be unquoted, in JSON only quoted strings may be used as properties.

Data types

JSON’s basic data types are:

  • Number: a signed decimal number that may contain a fractional part and may use exponential E notation, but cannot include non-numbers such as NaN. The format makes no distinction between integer and floating-point. JavaScript uses a double-precision floating-point format for all its numeric values (until later also supports BigInt[24]), but other languages implementing JSON may encode numbers differently.
  • String: a sequence of zero or more Unicode characters. Strings are delimited with double-quotation marks and support a backslash escaping syntax.
  • Boolean: either of the values true or false
  • Array: an ordered list of zero or more elements, each of which may be of any type. Arrays use square bracket notation with comma-separated elements.
  • Object: a collection of name–value pairs where the names (also called keys) are strings. The current ECMA standard states: “The JSON syntax does not impose any restrictions on the strings used as names, does not require that name strings be unique, and does not assign any significance to the ordering of name/value pairs.”[25] Objects are delimited with curly brackets and use commas to separate each pair, while within each pair the colon ‘:’ character separates the key or name from its value.
  • null: an empty value, using the word null

标签:definition,定义,may,JSON,strings,json,any,name
来源: https://blog.csdn.net/xuchaoxin1375/article/details/122738178

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有