I have the following JSON data:
{
"searchResults": [
{
"self": "https://api.icims.com/customers/xxxx/applicantworkflows/689997",
"id": 689997
},
{
"self": "https://api.icims.com/customers/xxxx/applicantworkflows/691005",
"id": 691005
}
]
}
I need to get the value of "id": 691005
I thought I could do something like this:
<script>
var myJson = ({
"searchResults": [
{
"self": "https://api.icims.com/customers/xxxx/applicantworkflows/689997",
"id": 689997
},
{
"self": "https://api.icims.com/customers/xxxx/applicantworkflows/691005",
"id": 691005
}
]
})
myArray = JSON.parse(myJson);
console.log(myArray[1]);
</script>
throws an error.
How can I get the value "691005" from the data using only JS not libraries?
()?JSON.parsestand for string content, and produce a JSON data. yourvar myJsonis already a JSON data