I'm trying to parse an incoming json string and push a new object to that.
I've tried it like this:
addSetting(category) {
console.log(category.value); //Console.log = [{"meta":"","value":""}]
category.value = JSON.parse(category.value).push({meta: "", value: ""});
console.log(category.value); //Console.log = 2
},
Problem is that category.value is 2? I would expect 2 json objects? What am I doing wrong here?
category.value = JSON.parse(category.value).push({meta: "", value: ""});is simply assigning the return value of thepushoperation tocategory.valuewhich before now doesn't exist.