I am attempting to extract values from an external JSON file and store certain values in an array. Here is my code :
$.getJSON("https://link.to.my.json", function(data) {
console.log(data); // this will display the information in the console
});
I am able to retrieve data from the JSON file, but I am unsure how to add the first and last names to the array [bob rooppo, peter sticker]. Any assistance on this matter would be greatly appreciated. Below is an example of the JSON data:
{
"users": [
{
"test": "123",
"name": {
"first": "bob",
"last": "roppo"
},
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4f2d202d0f28222e2623612c2020">[email protected]</a>",
"phone": "+123456789"
},
{
"test": "124",
"name": {
"first": "peter",
"last": "sticer"
},
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b7b6e7f6e794b6c666a626725686466">[email protected]</a>",
"phone": "+123456789"
}
]
}