Reputation: 509
I have the following JSON string which is outputed by:
{
"event":"build",
"tab":"map",
"selection":{
"tier":{
"id":1,
"parentId":0,
"label":"ca",
"level":100,
"hashKey":"object:5"
},
"group":{
"id":2,
"parentId":1448818,
"label":"com",
"spatialLevelId":203,
"hashKey":"object:11"
},
"area":{
"id":3,
"parentId":1449705,
"label":"cam",
"level":303,
"hashKey":"object:14"
},
"indicators":[
]
}
}
How can I get the level only from all 3 sections (tier, group, area) and put them into a variable?
Upvotes: 1
Views: 39
Reputation: 28475
You can retrieve the values like following
function handler(message) {
var tierSpatialLevelId = message.selection.tier.spatialLevelId;
var groupSpatialLevelId = message.selection.group.spatialLevelId;
var areaSpatialLevelId = message.selection.area.spatialLevelId;
}
Upvotes: 1