I need assistance in converting a parser to JSON for a new server response.
Previous server response:
{"names":[{"name":"Oleg","act":0,"total":0},{"name":"Vitya","act":2,"total":2}]}
Existing parser:
names = appData.filter( function(x) { return skipped.indexOf(x) < 0; })
get("https://serv.io/set?" + names.join("|")).then(function(data) {
result = JSON.parse(data)["names"]
for (var i = 0; i < result.length; i++) {
name = result[i]["name"]
act = result[i]["act"]
total = result[i]["total"]
}
New server response:
{"Oleg":{"act":0,"total":0},"Vitya":{"act":2,"total":2}}
In the updated response, there is no array and the object's name matches the name. I am seeking guidance on modifying the old parser for the new server response. Your help would be greatly appreciated!