Being new to vue js, my goal is to loop through the provided JSON data and check if the required data is present within the file. Here is a snippet of the JSON:
[
{
"id": "text-5",
"widget": "hello",
"params": {
"0": "section-right",
"name": "Right",
"id": "section",
"description": "",
"class": "",
"after_title": "",
"widget_id": "text-5"
},
"instance": {
"title": "St",
"text": "",
"filter": false,
"sidebar": "se-right",
"sidebar-order": 0,
"inherited": "yes",
"number": 0
}
},
{
"id": "text-5",
"widget": "hello",
"params": {
"0": "section-right",
"name": "Right",
"id": "section",
"description": "",
"class": "",
"after_title": "",
"widget_id": "text-5"
},
"instance": {
"title": "Twitter Feed",
"twitteruser": "Stei",
"sidebar": "sectht",
"sidebar-order": "4"
}
}]
My objective is to iterate over the data and identify if the key "instance" contains the value twitteruser.
This is the code I attempted:
const data = JSON.parse(res).data
console.log(data[0].instance)