In order to parse JSON into a JavaScript object with data, I am providing a simple example below:
var IsTrue = true;
var Number = 9;
var Object = { a : 1};
var Array = [10,6];
var jStr = '{"ask" : IsTrue, "value" : Number, "obj" : Object, "arr" : Array}';
var js = JSON.parse(jStr);
console.log(js);
You can find my work on this in the following jsfiddle link: http://jsfiddle.net/n4tLgp5k/1/
However, when trying to execute this code snippet, I encountered an error message:
Uncaught SyntaxError: Unexpected token I
My goal is to successfully parse JSON into a JavaScript object, having the variables in the object initialized with values from previously initialized variables.