RyanMarcus / dirty-json

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

Errors too general #11

Closed potatowave closed 6 years ago

potatowave commented 6 years ago

Awesome script.

I have a rather large chunk of I'm trying to clean. When dirty-json hits an error I get "Error: Got a :value that can't be handled" or similar, and a stack trace that isn't very helpful.

It would be really handy if I could see a decent snippet of the offending JSON so I can manually try to fix it before re-running.

RyanMarcus commented 6 years ago

I agree the default error message isn't very good. I added it to parts of the parser where I wasn't sure what the correct action would be, and I haven't paid enough attention to these cases yet. I'm a little busy this week, but I'll see what I can do.

RyanMarcus commented 6 years ago

I took a quick pass at adding row and column numbers to the error messages. There's a few tricky cases, so I'm not sure if they will always be accurate. I'll look more soon, but for now you can try out the current master:

npm install git+https://git@github.com/RyanMarcus/dirty-json.git
RyanMarcus commented 6 years ago

This feature is available in 0.5.4.