My auto search module has the following JSON structure. I need to iterate through an array of JSON objects and use keys and values as required.
I have attempted the code below. However, with the provided JSON object, I am able to retrieve the key but not the value.
For example, for the first JSON object, I need to retrieve 'Product Apple', but I am only getting the link.
I tried response.data[key][0]
, but I am getting the full JSON object instead. Can you point out where I may have gone wrong?
I have updated the Plunker below:
[{
"/folder1/folder2/folder3/product-1": "Product Apple"
},
{
"/folder1/folder2/folder3/product-2": "Product samsung"
},
{
"/folder1/folder2/folder3/product-3": "Product lenovo"
},
{
"/folder1/folder2/folder3/product-4": "Product Asus"
},
{
"/folder1/folder2/folder3/product-5": "Product Acer"
},
{
"/folder1/folder2/folder3/product-6": "Product Vivo"
},
{
"/folder1/folder2/folder3/product-7": "Product Oppo"
}
]