Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider API methods supporting io.Reader #53

Open
maxthomas opened this issue Aug 16, 2019 · 1 comment
Open

consider API methods supporting io.Reader #53

maxthomas opened this issue Aug 16, 2019 · 1 comment

Comments

@maxthomas
Copy link

passing around io.Readers is broadly supported in the golang ecosystem, but this API only supports []byte as input.

have you considered adding support for taking in io.Readers in the API?

@dolmen
Copy link

dolmen commented Apr 28, 2020

Supporting an interface which is a subset of json.Decoder as input would be more useful. json.NewDecoder can take an io.Reader as input.

See how package github.com/dolmen-go/jsonptr uses jsonptr.JSONDecoder as input for extracting data from JSON documents with jsonptr.Get:

type JSONDecoder interface {
	Token() (json.Token, error)
	More() bool
	Decode(interface{}) error
}

Disclaimer: I'm the author of this jsonptr package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants