There is a global JSON object in the JSON library, including two methods: the serializer or parse() and the parser stringify()
The following describes the use of one of these two methods:
1.parse() is used to parse JSON strings into objects or arrays
var jsonText = '{"userName":"zhangsan","password":"123456"}' ;//Note: Each attribute name and value must be written in double quotes, and single quotes are written outside, otherwise an exception will occur.
var changeJson = JSON.parse(jsonText);
console.log(changeJson);//The result is an object, Object {userName: "zhangsan", password: "123456"}
2. stringify() is used to parse an object or array into a text string containing serialized JSON
var arr = ['c', 'b', {test:'c'}];
var arrchange = JSON.stringify(arr);
console.log(arrchange);//The result is a string in JSON format, ["a","b",{"test":"c"}]