javascript - Can data in json format be converted into a normal string
怪我咯
怪我咯 2017-05-18 10:58:08
0
2
487

I use json.stringify() to get the data when submitting the form. Return as follows.
{"domains":[{"value":"vvvvvvvvv"}],"cona":"heeheeheeheeheeheeheexia","conb":"minutes, points, points, points v"}

Can it be converted into a normal string format? I want to convert it into the following format. I have tried many methods without success.

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
淡淡烟草味

Just extract the following content and splice it together

淡淡烟草味

json is essentially a string, but it is a "formatted" string.
If you want to convert it to other strings, you need to write your own rules, such as:

var objFormat = {toString:function(){return this.domains.map(function(item){
return item.value;
}).join(',')+','+this.cona+','+this.conb}};
var jsonStr   = '{"domains":[{"value":"vvvvvvvvv"}],"cona":"嘻嘻嘻嘻嘻嘻下","conb":"分分分分分分v"}';
var parsedString = objFormat.toString.call(JSON.parse(jsonStr));
// 得到 vvvvvvvvv,嘻嘻嘻嘻嘻嘻下,分分分分分分v
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!