I received a JSON response that looks something like this.
{
returnCode: 'Success',
info: null,
result: {
payload: '{
"BatchNo":"143123",
"Supplier":"Automotive",
"ItemNumber":"AP123",
"ProdNumber":"\\"\\"",
"ItemIdentifier":"PROCURE"}
{
"BatchNo":"143123",
"Supplier":"Manufacturing",
"ItemNumber":"API124",
"ProdNumber":"PRD123",
"ItemIdentifier":"PRODUCE"}',
encode: 'UTF-8'
},
txid:'8d9efd6083e6ca737e9c751baecd0c75cf738e9ce0e599bcfa26910575fa6d5f8d9efd6083e'
}
I am trying to figure out how to access the result.payload.ItemNumber
values without using arrays in the JSON data. Is there anyone who can assist me with this so I can display the following output?
AP123
AP124
I attempted the code below, but it did not work. Can someone please provide guidance?
var output1 = JSON.parse(json).result.payload[1].ItemNumber;
console.log("Data:"+ output1);
Thank you.