I am trying to use eval() function to deserialize this JSON text by using eval function.
var personJSON = {
"FirstName": "Burak",
"LastName": "Ozdogan",
"Id": "001",
"Department": "Information Technologies"
};
var personBurakOzdogan = eval('(' + personJSON + ')');
But I am getting this error:
*Microsoft JScript compilation error: Expected ']'*
Is there something that I skip which I cannot catch?
Thanks
What you have is not JSON text. It is already a JSON object. So you don't need to use eval
at all. You can directly access and manipulate its properties:
alert(personJSON.FirstName);