Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Latest commit

 

History

History
45 lines (39 loc) · 1.19 KB

json.md

File metadata and controls

45 lines (39 loc) · 1.19 KB

JSON

JSON是一种应用非常广泛的数据交换格式。其包含6种基本的数据类型。

JSON数据类型 示例
string "lnh"
number 1.23
array [...]
object {...}
bool true/false
null null
  1. JSON的命名遵循命名规范#JSON
  2. JSON中没有原生的日期和时间类型,应该遵循日期和时间的格式化规范的要求,使用string类型表示。
  3. JSON中出现的和国际化相关的数据遵循国际化规范中的要求。
  4. null值的字段不能忽略掉,应该显式的表示为"field_name":null

JSON示例:

{
  "first_name": "li",
  "lase_name": "nianhui",
  "gender": "MALE",
  "age": 123,
  "tags": ["coder"],
  "is_admin": true,
  "address": null,
  "country_code":"CN",
  "currency_code":"CNY",
  "language_code":"zh",
  "locale_code":"zh-CN",
  "created_at":"2018-01-02T03:04:05.128Z+08:00",
  "time_zone":"+08:00"
}

参考资料

http://json.org/

https://tools.ietf.org/html/rfc7159