How can I efficiently loop through each "book" to ensure the same execution for all?
This is how my JSON
looks like:
{
"bookstore": {
"book": [
{
"-category": "cooking",
"title": {
"-lang": "en",
"#text": "Everyday Italian"
},
"author": "Giada De Laurentiis",
"year": "2005",
"price": "30.00"
},
{
"-category": "children",
"title": {
"-lang": "en",
"#text": "Harry Potter"
},
"author": "J K. Rowling",
"year": "2005",
"price": "29.99"
},
{
"-category": "web",
"title": {
"-lang": "en",
"#text": "Learning XML"
},
"author": "Erik T. Ray",
"year": "2003",
"price": "39.95"
}
]
}
}
I can easily create headings for each book and display their content, but when it comes to looping through them, that's where I struggle. Can anyone provide some guidance or ideas on how to accomplish this?