forum

Home / DeveloperSection / Forums / How to parse into JSON object using JSON.parse() in Node.js

How to parse into JSON object using JSON.parse() in Node.js

Anonymous User799802-Apr-2013
Hi Guys

I am having the following string object and I want to create a JSON object out of it and store it in MongoDB.

    var strMYDATA = '{"Name":"ABC","SignedDate" : ISODate("2013-04-02T09:07:42.282Z")}';
I tried the following to create a JSON object out of strMYDATA

    var JSONobj = JSON.parse(strMYDATA);
    console.dir(JSONobj);
Getting the following error:

undefined:1
 "Name":"ABC","SignedDate" : ISODate("2
                              ^
SyntaxError: Unexpected token I
    at Object.parse (native)
Could anyone know how to parse the string with ISO date field like above in Node.JS?

Note: Cannot change the strMYDATA content because it a serialized object received from other Node.JS restful API.

Thanks


Updated on 02-Apr-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By