Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to do dot-walking in JSON when attribute are not static?

Vijay Kumar21
Tera Contributor

Hi Team,

 

How can we read an attribute when dot-walking attribute are not static.

 

example :- I want to read an attribute - 'cancel' (static), but for reading this I need to dot-walk from result.

 

Issue is, attribute  - '11633', 'Underground Terminal', '3212073', '2468', 'Location' are not static, attribute will get change dynamically  based on the particular request.  

{
  "result": {
    "11633": {
      "Underground Terminal": {
        "3212073": {
          "2468": {
            "Location": {
              "static": {
                "cancel": "false"
              },
              "static": {
                "cancel": "false"
              }
            }
          }
        }
      }
    }
  }
}

 

is this case how we should dot-walk non static attribute ?

 

 

4 REPLIES 4

RaghavSh
Mega Patron

Did you explore in javascript? using that method you can get the desired value.

 

Refer :https://stackoverflow.com/questions/3068534/getting-javascript-object-key-list 


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

@Vijay Kumar21 did this work for you?


Raghav
MVP 2023
LinkedIn

Jaspal Singh
Mega Patron
Mega Patron

Hi Vijay,

Just a suggestion, to convert it to string and then may be try using subString()

Ankur Bawiskar
Tera Patron
Tera Patron

@Vijay Kumar21 

Unless it's static you won't know what to fetch

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader