Accessing value within JSON Array

 in this example:

"results": [
{ "id": "xyz", "title": "His Honour Judge", "known_as": "Joe", "surname": "Blogs", "appointments": [ { "role": "Circuit Judge", "role_name": "Circuit Judge", "type": "Courts" }
...







we wish to access the appointments.role value

script:

var obj = JSON.parse(resp); var results = obj.result.results; for (var i = 0; i < results.length; i++) { var sID= results[i].id; var sRole = results[i].appointments[i].role; }





Comments

Popular posts from this blog

GlideRecord setValue

variable advanced reference qualifier example

URL link in addInfoMessage