JSON.parse用于把jsonString转换成jsonObject:
var jsonString= '{"key":"value","key":"value"}'; var jsonObject = JSON.parse(jsonString); console.log(jsonObject); //输出:[object:Object]
JSON.stringify用于jsonObject转换成jsonString:
var jsonObejct = {"key":"value","key":"value"}; var jsonString = JSON.stringify(jsonObject); console.log(jsonString); //输出:'{"key":"value","key":"value"}'原文链接:https://www.f2er.com/json/289487.html