I am converting the following JSON variable to string. When back to JSON, I'm getting an error (in ReactJS, although it shouldn't be important).
var questionGlobal = {
"questionCons": [{
"string": "In",
"alignment": 2
}, {
"string": "New York State",
"alignment": 1
}, {
"string": "the",
"alignment": -1
}, {
"string": "shortest",
"alignment": -1
}, {
"string": "period",
"alignment": 0
}, {
"string": "of",
"alignment": 2
}, {
"string": "daylight",
"alignment": 0
}, {
"string": "occurs",
"alignment": 2
}, {
"string": "during",
"alignment": 1
}, {
"string": "which",
"alignment": 0
}, {
"string": "month",
"alignment": 0
}],
"options": [{
"string": "January",
"alignment": 1
}, {
"string": "December",
"alignment": 2
}, {
"string": "June",
"alignment": 1
}, {
"string": "July",
"alignment": 1
}]
};
Here is the command:
window.console.log( eval(JSON.stringify(questionGlobal)));
The output that I get in console is:
Uncaught SyntaxError: Unexpected token
Any idea where I am doing it wrong?