For a two string:
String 1:{title:{},tooltip:{trigger: "axis"},legend:{data:["new followers"]},calculable:true,xaxis:[{type: category, boundarygap:false,data:["2016-01-01", "2016-01-02", "2016-01-03", "2016-01-04", "2016-01-05", "2016-01-06", " 2016-01-07 "]}],yaxis:{},series:[{name: New number of followers", type: "line", data:[11,11,15,13,12,13,10]}]}
String 2:
{"title": {}, "tooltip": {"trigger": "Axis"}, "Legend": {"Data": ["new number of followers"]}, "calculable": True, "Xaxis": [{"Type": " Category "," Boundarygap ": false," data ": [" 2016-01-01 "," 2016-01-02 "," 2016-01-03 "," 2016-01-04 "," 2016-01-05 "," 2016-01-06 "," 2016-01-07 "]}]," YAxis ": {}," series ": [{" Name ":" New number of followers "," type ":" Line "," Data ": [11,11,15,13,12,13,10]}] }
Can you see what the difference is between two JSON?
In JS, directly when the JSON data used, can normally parse out the JSON data.
But the string 1, when the format is validated in http://www.kjson.com/,
Parse error on line 1:{ title: { -----^expecting ' STRING ', '} '
String 2 is normal.
When put in JS, string 1 and string as strings into JSON format data, string 1 error, prompt, and string can be converted to JSON format data.
What is the reason, as if it does not seem to be too much, for what reason?
In essence, you have to look at the syntax definition of JSON.
The writing format for JSON data is: name/value pairs.
name/value pairs include the field name (in double quotation marks), followed by a colon, and then the value:
"FirstName": "John"
Important thing to say three times: name/value pairs include field names (in double quotes), be sure to remember the most in double quotes
Knowledge Extension:
Json:javascript Object Notation (JavaScript object Notation).
JSON is the syntax for storing and exchanging textual information. Similar to XML.
JSON is smaller, faster, and easier to parse than XML.
Like XML
JSON is plain text
JSON has a "self-descriptive" (Human readable)
JSON has a hierarchy (values exist in values)
JSON can be parsed with JavaScript
JSON data can be transmitted using AJAX
Compared to the difference between XML
No end tag
Even shorter
Read and write faster
Ability to parse using the built-in JavaScript eval () method
Working with arrays
Do not use reserved words
Why use JSON?
For AJAX applications, JSON is faster and easier to use than XML:
Using XML
Reading an XML document
Using the XML DOM to iterate through a document
Read the value and store it in a variable
Using JSON
Reading JSON strings
Working with the JSON string with eval ()
A problem caused by the non-uniform specification of JS JSON and string conversion process