The following data is retrieved from the MongoDB
console.log(x)
The output
{ _id: 54473495721e8a7386959897,
tag: 'java',
data:
[
{ view: '2342343', date: '2001/1/25' }
]
}
While parsing using JSON.parse
var dataJson = JSON.parse(x);
it thwors the below error
undefined:1
{ _id: 54473495721e8a7386959897,
^
SyntaxError: Unexpected token _
at Object.parse (native)
xis already an Object. Dont need toJSON.parse