Closed bsuh closed 2 years ago
Thank you for reporting this issue.
This is because the current implementation of jsone:decode/1
just discards the remaining (unconsumed) binary in this line.
It feels better to raise an error if the remaining binary size is not empty (maybe it's worth allowing binaries that only contain whitespace characters though).
Allowing whitespace after seems reasonable. JavaScript API JSON.parse()
allows whitespace after (but not garbage characters).
>> JSON.parse(" 1")
1
>> JSON.parse(" 1 ")
1
Thank you for your information! I'll implement this check this or next week (however, if you're interested in doing that, the contribution is very welcomed).
FYI: Created PR #69
This is on version 1.5.6 as well as master branch.