This is from data submitted with a form. I have no control over the generation of the JSON because it is done using JSON.stringify()
. On the server I receive the following JSON string which I want to parse back into a Javascript object using JSON.parse()
.
However there seems to be a problem at the "uploadedFilename"
part which JSON.parse()
can't handle but I don't understand why or what it is:
[
'{"originalFilename":"A.jpg","uploadedFilename":"A-15904372.jpg","size":9149216,"type":"image/jpeg","isUploading":false,"isUploaded":true,"uploadPromise":{},"uploadProgress":100,"invalidFileMessage":null}'
,
'{"originalFilename":"B.jpg","uploadedFilename":"B-972341252.jpg","size":9149216,"type":"image/jpeg","isUploading":false,"isUploaded":true,"uploadPromise":{},"uploadProgress":100,"invalidFileMessage":null}'
]
JSON.parse()
return the following error:
SyntaxError: Unexpected token u in JSON at position 0
So I put the code into https://jsonformatter.org and the error says:
Parse error on line 1:
[ '{"originalFilename"-------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', ']', got 'undefined'