wanglingsong / JsonSurfer

A streaming JsonPath processor in Java
MIT License
294 stars 55 forks source link

Gson parser should support lenient parsing #42

Closed cmuchinsky closed 6 years ago

cmuchinsky commented 6 years ago

By default Gson's JsonReader class uses strict parsing which seems logical, however once you start trying parse real world json data you frequently run into the following:

MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line ...

It would be nice if the JsonReader used by GsonParser was lenient by default, or at least had a way to configure it for lenient parsing.

wanglingsong commented 6 years ago

Sure, I think I can add an interface for GsonParser to accept Gons's JsonReader, then you can construct whatever you want and pass it to GsonParser.

wanglingsong commented 6 years ago

@cmuchinsky I just submitted a fix which should solve your problem. Looking forward yo your response.

cmuchinsky commented 6 years ago

The fix worked for me, thanks!