Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does SJCL report "this is not JSON" when trying to decode this JSON snippet?

Tags:

json

sjcl

I'm using SJCL, and it works fine with small ASCII strings.

But when I try to decode this piece of JSON (the result of the encryption of an HTML page) I get a "this is not JSON!" error.

The JSON has been produced by SJCL, and while I did encode it and decode it using LZW and base64 I don't get this error for small strings with the same workflow.

I tracked the error message origin to the decode function. I assume the regexes are failing but I don't understand why as this seems to be a perfectly formed JSON string to me.

However, I can be wrong as if I do a JavaScript eval on it it fails on a syntax error. But if I dump it in a file Python parse it fine.

like image 867
e-satis Avatar asked Oct 08 '22 23:10

e-satis


1 Answers

The json that is at your this piece of json link starts and ends with a double-quote character. Is that actually part of the contents of the json? If it is, I believe that is your problem. Otherwise, it looks like valid json to me.

like image 157
Sean Mickey Avatar answered Oct 12 '22 00:10

Sean Mickey