Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrStop can be returned from a JSONCallback function to indicate that processing should stop at this object ErrStop = errors.New("stop processing json") )
Functions ¶
func Reader ¶
func Reader(reader io.Reader, callback JSONCallback) (err error)
Reader reads all JSON and JavaScript objects from the input and calls callback for each of them. If callback returns an error, Reader will stop processing and return the error. If the returned error is ErrStop, Reader will return nil instead of the error. Please note that reader must return UTF-8 bytes, if you're not sure use the charset.NewReader method to convert to the correct charset (https://pkg.go.dev/golang.org/x/net/html/charset#NewReader)
func ReaderObjects ¶
func ReaderObjects(reader io.Reader) (objects []json.RawMessage, err error)
ReaderObjects takes the given io.Reader and reads all possible JSON and JavaScript objects it can find
Types ¶
type JSONCallback ¶
JSONCallback is the callback function passed to Reader. Found JSON objects will be passed to it as bytes. If this function returns an error, processing will stop and return that error. If the returned error is ErrStop, processing will stop but not return an error.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
jsonx
command
|
|
|
examples
|
|
|
readme
command
|
|
|
string
command
|
|
|
stackoverflow-chart
module
|
|
|
parsefork
|
|
|
buffer
Package buffer contains buffer and wrapper types for byte slices.
|
Package buffer contains buffer and wrapper types for byte slices. |
|
js
Package js is an ECMAScript5.1 lexer following the specifications at http://www.ecma-international.org/ecma-262/5.1/.
|
Package js is an ECMAScript5.1 lexer following the specifications at http://www.ecma-international.org/ecma-262/5.1/. |
