I am deserializing strings using JSON.parse. Most of the time, I have a contentful object serialized into a string, and JSON.parse works on that string, but in some cases, I want to send a minimum input to JSON.parse, whose result will just be thrown away. When I send "" like: JSON.parse(""), it returns an error: unexpected token at '""'. What is the restriction of JSON specification that I am violating, and what alternative minimum string can I send to JSON.parse?
I am deserializing strings using JSON.parse . Most of the time, I have a
Share
Reading the JSON specification that Musa provided a link to, one minimum object that can be stringified and sent to JSON seems to be:
or something like that. Or, in the stringified form, it will be: