隐藏在字符串下面的简单文本

时间:2017-06-26 17:50:42

标签: javascript jquery json

var arr2 ='{s:10:\"product_id\";s:11:\"11762430743\";s:13:\"product_price\";i:50;s:12:\"product_name\";s:68:\"Mercedes-AMG GT S 2016 In detail review walkaround Interior Exterior\";s:12:\"channel_name\";s:8:\"goplh114\";s:1:\"v\";s:11:\"Y1WzBFJFit8\";}';

如何获得以下JSON结果:

product_id:11762430743
product_price:50
product_name: Mercedes-AMG GT S 2016 In detail review walkaround Interior Exterior
channel_name: goph114

1 个答案:

答案 0 :(得分:1)

使用JSON.parse("your string")

顺便说一句。您的JSON字符串不会被正确格式化。你可能想检查一下。 https://jsonlint.com/