JSON(JavaScript Object Notation)
It was said that there are only three basic data structure primitives: mappings (hashes/dictionaries), sequences (arrays/lists) and scalars (strings/numbers). The scalar represents strings, integers, dates, and other atomic data types.
JSON defines all the data structures:
1. Sequences (arrays/lists) and Scalars (strings/numbers), separated by, (comma).
2. Mappings (hashes/dictionaries) are the name/value pairs, uses the format name : (colon) value.
3. Set of name/value pairs, set enclosed by a pair of curly braces{}, then begins with { (left brace) and ends with } (right brace).
4. Set of Sequences (arrays/lists) and Scalars (strings/numbers), set begins with [ (left bracket) and ends with ] (right bracket). For Example: An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket).
* 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. Douglas Crockford designed JSON.
21世纪初,Douglas Crockford寻找一种简便的数据交换格式,能够在服务器之间交换数据。当时通用的数据交换语言是XML,但是Douglas Crockford觉得XML的生成和解析都太麻烦,所以他提出了一种简化格式,也就是Json。
1) 并列的数据之间用逗号(",")分隔。2) 映射用冒号(":")表示。3) 并列数据的集合(数组)用方括号("[]")表示。4) 映射的集合(对象)用大括号("{}")表示。
上面四条规则,就是Json格式的所有内容。
(cite: www.ruanyifeng.com/blog/2009/05/data_types_and_json.html, yaml.org/spec/1.2/spec.html ,www.json.org/)
评论
发表评论