1.1. Introduction to JSON 1.1.1. What is JSON
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is based on a subset of JavaScript. The JSON value can be a number (integer or floating point), a string (in double quotes), a logical value (TRUE or false), Array (in square brackets), object (in curly braces), function , empty string , null
1.1.2. Structure of JSON
1.      object: Object in js "{}" {key : value, Key : value,...} key value object .key Gets the property value, the type of the property value can be A number, a string, an array, a few objects.
2. array: The array in JS is bracketed "[]" in the content, the data structure is ["java", " JavaScript "," VB ",...] , the value is obtained in the same way as in all languages, and the type of the field value can be Several types of numbers, strings, arrays, and objects.
1.2. JSON and string conversion 1.2.1. JSON converted to string
Json.stringify (Jsonobj)
1.2.2. String conversion to JSON
Varjsonstr = ' {' name ': ' Zhang San ', ' age ': 22} ';
Varjsonobj = eval ("(" +jsonstr+ ")");
1.3. JSON traversal
<scripttype= "Text/javascript" >
Varjsonobj = {"Name": "Zhang San", "Age": 22};
jsonobj.id=1;
for (var key in Jsonobj) {
Alert (key+ ":" +jsonobj[key])
}
</script>
JS Operation JSON