[Vuejs]-How to get specific property from another object?

0👍

have you try JSON.parse(data);

Example:

var data = '{ "products": [{ "sku": "70741", "name": "Name", "image": "name.png", "quantity": 12, "price": { "value": 2.10, "type": "simple" }, "attributes": { "0": "2", "1": "4", "2": "2|1|3", "3": "1|2", "4": "2", "5": "6|7" } } ], "attributes": [{ "id": 0, "name": "name1", "type": "type1" }, { "id": 1, "name": "name2", "type": "type2" }, { "id": 2, "name": "name3", "type": "type1" } ], "attributesIdValue": [ "companyName1|companyName2|companyName3|companyName4", "typeName1|typeName2|typeName3|typeName4", "address1|address2|address3|address4", "1|2|3", "country1|country2|country3|country4", "number1|number2|number3|number4" ]}';


obj = JSON.parse(data);

console.log(obj.attributes[0].name);

Leave a comment