如何转换为JSON对象?

时间:2017-06-28 08:46:28

标签: javascript jquery json

我以下面的格式从后端获取一些字符串,如何将其解析为JSON。

"{messages:"[{message_type:S,message_text:Instance 20000001002700000279 of object type RentalObjectREFX has been changed.}{message_type:S,message_text:Email sent sucessfully}]"}"

1 个答案:

答案 0 :(得分:0)

喜欢那个

var json = JSON.parse('{"messages":"[{message_type:S,message_text:Instance 20000001002700000279 of object type RentalObjectREFX has been changed.}{message_type:S,message_text:Email sent sucessfully}]"}');

console.log(json);