Documentation
¶
Overview ¶
Package jsoniter provides iterators over streamed JSON.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DecodeArray ¶
DecodeArray returns an iterator over a JSON array's decoded values.
When it finds the ']' (array end) token, it stops iterating. However when it encounters an error, it also stops and returns a zero value [T], along with the encountered decoding error. In that case, it is up to the caller to either discard or keep the previously decoded values.
An empty JSON will return no error and no values to iterate over. Same goes for an invalid (nil) io.Reader.
type Entry struct { /* ... */ }
resp, _ := http.Get("...")
for entry, err := range jsoniter.DecodeArray[Entry](resp.Body) {
if err != nil {
// Nothing else can be decoded, do something with the error.
break
}
// Do something with the decoded entry.
_ = entry
}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.