RyanMarcus / dirty-json

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

Extra white space after entry name #27

Closed RezaRahmati closed 4 years ago

RezaRahmati commented 4 years ago

Hi

I was using v0.7, and this was in my unit tests

        json: 'id: \"test\"\nlang: \"en\"\nresult {\n  source: \"agent\"\n}',
        expect: `{"id":"test","lang":"en","result": { "source":"agent"}}`

After upgrading to 0.8 or 0.9 this is broken and it returns below json

        expect: `{"id":"test","lang":"en","result ": { "source":"agent"}}`

There is an extra white space after result

RyanMarcus commented 4 years ago

Huh, without the starting {, I'm surprised any version of the parser worked on that input!

I added a few extra rules to the parser that should catch this case, and I added your input to the unit tests. :)

Should be fixed in NPM version 0.9.1.

RezaRahmati commented 4 years ago

Thank you

On Wed., Jul. 1, 2020, 12:44 p.m. Ryan Marcus, notifications@github.com wrote:

Huh, without the starting {, I'm surprised any version of the parser worked on that input!

I added a few extra rules to the parser that should catch this case, and I added your input to the unit tests. :)

Should be fixed in NPM version 0.9.1.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RyanMarcus/dirty-json/issues/27#issuecomment-652529089, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACM6NTEDQX3QVKKYTIFHD4LRZNRVBANCNFSM4ONO4EZA .

RezaRahmati commented 3 years ago

@RyanMarcus I just upgraded to 0.9.2 and same issue still exists