1 pages introduce jqueryjson-22js and jquery-1102minjs versions that can be controlled by yourself this can be seen from $ parseJSON (json) That parseJSON's interpretation in the document is: accept a JSON string and return the parsed object. Input an exception
1. Pages introduced jquery. json-2.2.js and jquery-1.10.2.min.js versions can be controlled by yourself
We can see from $. parseJSON (json) That parseJSON is interpreted:
Accepts a JSON string and returns the parsed object.
Inputting a malformed JSON string throws an exception. For example, the following are malformed JSON strings:
{Test: 1} (test is not surrounded by double quotation marks) // key
{'Test': 1} (using single quotes instead of double quotes) // key
Here is an example.
Var data = '[{"time": "10:25:36" },{ "starttime": "09:00:00" },{ "endtime": "12:00:00"}]';
Var msg = $. parseJSON (data); understand the usage of $. parseJSON (). This function accepts a JSON string and returns the parsed object.
Var time = msg [0]. time;
Var start = msg [1]. starttime;
Var end = msg [2]. endtime;
Alert (time); // value: 10:25:36
Alert (start); // value: 09:00:00
Alert (end); // value: 12:00:00