Documentation ¶
Overview ¶
Package parse is a streaming parser for JSON objects
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Iterate ¶
Iterate parses a JSON document into an iter[json.Value]. If the document is an object, the object is parsed completely before returning it as an iter of one element. If the document is an array, the array top level elements are parsed as the returnd iter is iterated.
Useful for cases like writing JSON data to a database, where the JSON input could contain a large number of records, and it is preferable to store each record one at a time, or perhaps in batches of some fixed maximum size.
func Parse ¶
Parse parses a JSON document fully before returning it, unlike Iterate which provides an iter. Useful for cases like a configuration file, where you need the whole document, and it is easier to not have to iterate. The top level object or array is provided as a Value. If the reader can be parsed into a valid json document the result is (Value, nil), else it is (invalid value, error).
Types ¶
This section is empty.