3

In java there are ways to do so

http://www.mkyong.com/mongodb/java-mongodb-convert-json-data-to-dbobject/

looking for the same in nodejs/frontend code. is there any way?

currently using

https://www.npmjs.com/package/loose-json

but no support for ObjectId for example..

guy mograbi
  • 27,391
  • 16
  • 83
  • 122

1 Answers1

0

Since NodeJS is javascript, all you need to do is:

JSON.parse(jsonString);
Community
  • 1
  • 1
Daniel Minnaar
  • 5,865
  • 5
  • 31
  • 52
  • 1
    That will not work in the example given in : http://www.mkyong.com/mongodb/java-mongodb-convert-json-data-to-dbobject/ - the link I pasted in the question deliberately.. As mongo queries are not necessarily valid JSON objects. – guy mograbi Jul 11 '16 at 13:53