json-iterator / go

A high-performance 100% compatible drop-in replacement of "encoding/json"
http://jsoniter.com/migrate-from-go-std.html
MIT License
13.34k stars 1.02k forks source link

Return struct errors compatible with `encoding/json` #572

Open luxas opened 3 years ago

luxas commented 3 years ago

Hi, thanks for this nice project!

It would be really nice if this project would return errors (exactly or wrapping) e.g. json.UnmarshalTypeError or json.SyntaxError, for even more compatibility with the stdlib.

Showing the context like this project already does now is still nice, hence I think it's acceptable to return an error wrapping the above mentioned structs and implementing the errors.Is/As interfaces for equality checking.

I would be happy to contribute this if accepted :+1:

iambudi commented 1 year ago

Agree. It's nice to get this implemented. I have to go back to the standard json decoder because of this.

adirizka7 commented 1 year ago

bringing this up 🆙

SyntaxNode commented 11 months ago

We were evaluating this library and got excited for 100% compatible drop-in replacement of "encoding/json". Unfortunately, we found a lot of cases where that statement doesn't hold up, this being one of them.