I have this JSON:
[[{"product_name":"prod-1","product_url":"http:\\www.google.com"}]]
CODE JS:
var giftLabel = window.checkout.giftLabel; // return json
var array = JSON.parse("[" + giftLabel + "]"); // transform in a array
for(var i = 0; i < array.length; i++) {
for(var j = 0; j < array[i].length; j++) {
var parse = JSON.parse(array[i][j]); //this line not working
console.log(parse.product_name); //this line not working
}
}
I want to extract the values from this JSON and choose an example
OUTPUT:
prod-1
http:\\www.google.com
Can you please tell me where I am wrong and why can't I extract the values from JSON correctly?