I want convert the following data into JSON object. But when is used JSON.parse() command it returns:
var r = JSON.parse(t)
SyntaxError: Unexpected token o in JSON at position 1
Here is sample data string which is to be converted
var t = { message:
[ { timestamp: 1522007930599,
tags: [Array],
_id: '5aacb7cc0281b558debacf26',
message_link: 'String',
__v: 0 },
] }
答案 0 :(得分:1)
JSON.parse
converts from JSON to a JavaScript data structure.
To go the other way you need JSON.stringify