RyanMarcus / dirty-json

A parser for invalid JSON
GNU Affero General Public License v3.0
294 stars 30 forks source link

Array of single object has error #2

Closed gopalganu closed 7 years ago

gopalganu commented 7 years ago

{ "key" : [{"a":"b"}] }

This JSON above has an error, it doesn't seem to like an array of single object.

It works after adding a second object in the array { "key" : [{"a":"b"}, {"c":"d"}] }

RyanMarcus commented 7 years ago

I've confirmed this. Yikes! Since that's valid JSON, this is a pretty nasty bug. I'll take a look today...

Thanks for the report. I can't believe I missed this case!

RyanMarcus commented 7 years ago

I've fixed this and added tests. The changes are available on NPM in version 0.3.1. If you could confirm that the fix works for you, that'd be great. :)

gopalganu commented 7 years ago

That worked. I think I found another one. Will report it as a separate issue. Appreciate the quick fix.