Looking at the JSON structure that I need to work with:
[
{
"result":"OK",
"message":"Display",
"value":200,
"rows":29
} ,
[
{
"personID":1,
"img_path":"/1234/",
"img":"00001.jpg"
},
{
"personID":2,
"img_path":"/1234/",
"img":"00002.jpg"
},
]
]
My goal is to extract ONLY this part:
personID: 1
img_path: /1234/
img: 00001.jpg
Currently, my code retrieves the entire JSON output. Here's a snippet of what I have been doing, which fetches and displays the full JSON response:
var fullURL = the_URL_where_Im_getting_the_json
function readTextFile(file, callback)
{
var rawFile = new XMLHttpRequest();
rawFile.overrideMimeType("application/json");
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4 && rawFile.status == "200")
{
callback(rawFile.responseText);
}
}
rawFile.send(null);
}
readTextFile(fullURL, function(text){
var data = JSON.parse(text);
console.log(data);
}
);
Your assistance in helping me retrieve only the specific portion of the JSON data is greatly appreciated. Thank you.