Recently, I attempted to parse an incoming JSON string and insert a new object into it.
The method I used looked 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
},
However, the issue is that category.value
returns 2
. Shouldn't it contain two JSON objects instead? Can anyone point out where my mistake lies?