I'm mentioning a strange behavior:
This is my source string: {"data":{"allowfullscreen":true,"duration":0,"keyboard":false,"imgclass":"","hrefclass":""},"images":[{"src":"storage/home-hero.jpg","alt":"Home hero"}]}
Now I'm doing this:
parsed = {};
try {
parsed = JSON.parse(data.matches[1]);
} catch (e) {}
console.log(JSON.parse(data.matches[1]));
console.log(parsed);
the results should be the same, right?
But the output is different:
Output #1 (JSON.parse(data.matches[1]);
)
Object
data: {allowfullscreen: true, duration: 0, keyboard: false, imgclass: "", hrefclass: ""}
images: [{src: "storage/home-hero.jpg", alt: "Home hero"}]
and Output #2 (parsed
):
Object
images: Array (1)
0 {src: "storage/home-hero.jpg", alt: "Home hero", __v-for__8: null}
Why aren't they the same?