-
Notifications
You must be signed in to change notification settings - Fork 23
Description
While working with this library I noticed an issue when loading user-created JSON. The offsets of the errors in JSON is completely broken in case of syntax errors.
Example (from my memory)
Input JSON:
In this case, the translation will remove comment and all unneeded whitespace and will result in something like this (not actual output)
{"field":"value",}When unmarshalling it, it will throw an error about trailing comma (actually about expecting a property, but it's caused by trailing comma) with offset of around 16. When applying this offset to the original JSON, the offset is completely wrong and the user cannot easily find it.
To fix it I left all whitespace in + replaced all comments with spaces in my fork of this library.
stirante@c4ec348
I understand that not many people might want this behavior which is why I propose to add it as a separate setting/mode.
{ //this is a comment "field": "value", }