My EjB response using AJAX likes this:
"{'Active':{'123','456','789'},'Inactive':{'111','222','333'}}"
I want to convert the above string to JSON objects. JSON objects will be used in JavaScript to draw the map.
Or
I want the same string to get converted like below in JavaScript:
var active = ["123", "456", "789"]; var inactive = ["111", "222", "333"];
Note: I'm using AJAX in JS.
var jsonString = JSON.parse(response);
response
是你从ajax req(一个json字符串)得到的,而jsonString就是你想要的
let JSON_Str = "{'Active':{'123','456','789'},'Inactive':{'111','222','333'}}"
Obj = JSON.parse(JSON_Str)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.