1

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?

1 Answer 1

1

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; 
} 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.