/**
* 数据
*/
var school = [{id:1,name:'一年级'},{id:2,name:'二年级'},{id:3,name:'三年级'}];
/**
* 对象转JSON字符串
*/
var str = JSON.stringify(school);
console.log(str)
//输出:[{"id":1,"name":"一年级"},{"id":2,"name":"二年级"},{"id":3,"name":"三年级"}]
/**
* JSON字符串转对象
*/
var obj = JSON.parse(str);
console.log(obj)
//输出:[Object, Object, Object]