I am trying to access merchant name in the following json:
[{“merchant_id”:”90151″,”merchant_name”:”Wimpy”}]
the above json formt is returned by an api, I tried access merchant_name value but all I got was none
below is what I tried:
fetch("http://127.0.0.1:8000/vcl/retrieve/"+url, {
method: "GET",
headers: {
"Content-Type": "application/json"
},
}).then((res) => res.json()).then((response) => {
console.log (response);
const data = JSON.stringify(response);
const info = JSON.parse(data);
var merchant_name = info.merchant_name;
console.log(merchant_name);
})
all I am getting is undefined