0

As you see in the image:

enter image description here

I've a array of object I think there is JSON array. I want to get only "productThumbnailUrl" on this array and use that in another way.

Can anyone help me to get this value and store it in a separate variable.

It's has multiple rows on the array. I only want get "productThumbnailUrl".

1

3 Answers 3

1

You can use For loop to loop json data

for(x in json) {
    console.log(json[x].productThumbnailUrl);
}
Sign up to request clarification or add additional context in comments.

Comments

1

var x = JSON.parse('{"productThumbnailUrl": "val1", "key2": "val2", "key3": "val3", "key4": "val4"}');

alert (x['productThumbnailUrl']);

var y = x['productThumbnailUrl'];

Comments

0

Let's consider your main array is

var products= [your product arr];
products.forEach(
function(product){
console.log(product["productThumbnailUrl"]);
});

it will list your productThumbnailUrls. it will loop through all items.

1 Comment

var json = $.cookie('cartArray'); var parsed = JSON.parse(json); var arr = []; for(var x in parsed){ arr.push(parsed[x]); } for(var i = 0; i<arr.length; i++){ arr[i]['productThumbnailUrl']; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.