QT中json和js对象相互转换

版权声明:如果对您有帮助,求点赞!本文为博主原创作品,转载请声明出处! https://blog.csdn.net/u011086209/article/details/86589960

JSON转JS

var obj = JSON.parse(byteArray); //JSON文本转js对象
console.log("cpp obj is",obj);
console.log("title: ",obj[0]);
console.log("jsonobject 1:",obj[1]["id"]);

JS转JSON

var jsonString=JSON.stringify(obj); //js对象转JSON文本
console.log("cpp jsonString is ",jsonString);

猜你喜欢

转载自blog.csdn.net/u011086209/article/details/86589960