go icon indicating copy to clipboard operation
go copied to clipboard

Return struct errors compatible with `encoding/json`

Open luxas opened this issue 2 years ago • 3 comments

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:

luxas avatar Aug 30 '21 15:08 luxas

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

iambudi avatar Dec 29 '22 23:12 iambudi

bringing this up 🆙

adirizka7 avatar Feb 08 '23 12:02 adirizka7

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.

SyntaxNode avatar Oct 06 '23 16:10 SyntaxNode