francoispqt / gojay

high performance JSON encoder/decoder with stream API for Golang
MIT License
2.11k stars 112 forks source link

More compataibility with encoding/json #44

Open freman opened 6 years ago

freman commented 6 years ago

It'd be sweet to be more compatible with the encoding/json Decode interface

Specifically functions like

func (dec *Decoder) More() bool
func (dec *Decoder) Token() (Token, error)

Seem to be missing with no equivilent.

Useful for parsing giant streaming files (of a single object) and splitting them into multiple objects - or extracting an array.

eg: https://ip-ranges.amazonaws.com/ip-ranges.json

Would be parsed by skipping through tokens until we got to the prefixes array, then parsed as a stream of objects until done

francoispqt commented 6 years ago

Hi,

Sure, I agree it would be a good idea. I'm ok for pull requests if you want to contribute. Otherwise I'll try to find time to do it.

Let me know if you want to add these or if I should do it. Thanks