微信小程序
//这是一个json对象
var jsonobj = {"sztno":"330890811","transTime":"2018-5-7 08:00:36","amt":"50"};
//json对象转成json字符串(同普通js中相同)
var jsonstr = JSON.stringify(jsonobj)
console.log("jsonstr=="+jsonstr)
//打印结果:"jsonstr=={"sztno":"330890811","transTime":"2018-5-7 08:00:36","amt":"50"}"
//由json字符串转成json对象,eval()函数在小程序用不了,被小程序禁用了
var obj1 = JSON.parse(jsonstr); //可用此方法来转换
console.log("json obj1=="+JSON.stringify(obj1))
//打印结果:"obj1=={"sztno":"330890811","transTime":"2018-5-7 08:00:36","amt":"50"}"