JSON data Format Description:
Https://en.wikipedia.org/wiki/JSON
JSON (JavaScript Object Notation) is a lightweight data interchange format
JSON syntax is a subset of JavaScript Object notation syntax:
- Key-value pairs
- Comma delimited
- Curly braces Save Object
- Square brackets Data
The key (field name) of the JSON is a string (double quotation marks)
The JSON value can be a number, a string, a logical value (True, false), an array (square brackets), an object (nested in curly braces), null
JSON file type: ". JSON"
Chestnuts:
{"Employees": [{true},{false},],"department": [{" Name ":" Tieba "," Emp_num ":" Location ": 2} {" name ":" Baike "," Emp_num ": $," location ": 3}]}
Parsing of JSON files:
shell:http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=4131068
-
- JQ
- Read a row of fields
- Local address= ' JQ. Employee[0].name tt.json ' (address variable is quoted "Peter")
Local address= ' JQ. Employee[0].name Tt.json | Sed ' s/\ '//g ' (replace double quotes with SED)
-
-
- View JSON file contents
- Find Values by key
- Select query
- JQ '. employee[] | Select (. name== ' Jone ') ' Tt.json
- Json.sh (a pipeable JSON parser written in Bash)
https://github.com/dominictarr/JSON.sh
Python:
JSON module: Used to convert between string and Python data types, and data serialization module Pickle uses the same
The JSON module provides four functions: dumps, dump, loads, load
ImportJsondata= {"name":"Police","Phone": [110, 911]}#JSON data equivalent to Python dictionary#write JSON format to fileWith Open ('Test.json','W') as Of:json.dump (data, of)#reading JSON filesWith Open ('Test.json','R') as Of:data= Json.load (OF)
Java
Reference: http://json.cn/json/code.html, also includes PHP and JavaScript construction parsing method
Two methods: Json_lib http://www.cnblogs.com/lanxuezaipiao/archive/2013/05/23/3096001.html
Json_lib need to rely on Ezmorph and Commons's lang, logging, Beanutils, collections and other components
Org.json http://www.cnblogs.com/lanxuezaipiao/archive/2013/05/24/3096437.html
Org.json package has no other dependencies, complete beans, collections, maps, arrays and XML and JSON conversions
The above link article provides a URL http://www.json.org/, a variety of language parsing JSON data tools are basically listed
JSON data Format understanding