1. Convert the string of json type to json object and get the value
var jsonString = '{"bar":"property","baz":3}';
var jsObject = JSON.parse(jsonString); //Convert to json object
alert(jsObject.bar); //Take the value in json
2. The json object is converted to a string of type json
var jsonString = '{"bar":"property","baz":3}';
var jsObject = JSON.parse(jsonString); //Convert to json object
alert(jsObject.bar); //Take the value in json
var st = JSON.stringify(jsObject); //Convert to a string of type json
3. Convert the string of json array type to json and convert the value and json object to json string
//json array type string value
var jsonStr = '[{"otherDims":"Indicator;Total Index;1990;2000;2010;2013;2014;Speed IndexIndicesandGrowthRates(%);Index(2014 is the following years);1978;1990;2000;2010;2013; Average growth rate;;;;","indexName":"The total population at the end of the year (ten thousand people)","annual_title_id":"tb182-y-002","parentNames":"","tableName":"National economy and Index of total social development and speed.xls","annualName":"Hebei Economic Yearbook (2015)"},{"otherDims":"index;total index;1990;2000;2005;2010;2011;2012;speed Indicators and GrowthRates (%); Index (2012 for the following years); 1990; 2000; 2005; 2010; 2011; Average growth rate; 1979-2012; 1991-1995; 1996-2000; ","indexName":"Total population at the end of the year (10,000 people)","annual_title_id":"tb508-y-002","parentNames":"","tableName":"Total and speed indicators of national economic and social development .xls","annualName":"Hebei Economic Yearbook (2013)"},{"otherDims":"Index;Total Index;1990;2000;2010;2012;2013;Speed Index IndicesandGrowthRates(%);Index(2013 is the following years);1978;1990;2000;2010;2012;Average Growth Rate;;;; ","indexName":"Total population at the end of the year (10,000 people)","annual_title_id":"tb653-y-002","parentNames":"","tableName":"Total and speed indicators of national economic and social development .xls","annualName":"Hebei Economic Yearbook (2014)"}]';
var jsonObj = JSON.parse(jsonStr);//Convert to json object
for(var i=0;i<jsonObj.length;i++){
alert(jsonObj[i].id); // Take the value in json
}
console.log(jsonObj)
var jsonStr1 = JSON.stringify(jsonObj)
console.log(jsonStr1+"jsonStr1")