After browsing through countless threads on the topic, I have yet to find a solution. I successfully parsed a JSON response that looks like this:
{
"1": {
"id": "1",
"name": "Fruit",
.
.
.
"entities": {
"1": {
"id": "1",
"name": "blue bird",
.
.
.
"status": "1"
},
"2": {
I used this code for parsing
let json = JSON.parse(body);
console.log(json);
Next, I want to access the "id", "name" fields as well as the "id" and "name" under the "entities" tag. I've attempted:
console.log(json[0]);
console.log(json.id);
However, both return undefined.
I also tried
console.log(json[0].id);
This resulted in an error message.
Any suggestions?