json-stream
Simple streaming JSON parser and encoder.
When reading JSON data, json-stream can decode JSON data in
a streaming manner, providing a pythonic dict/list-like interface, or a
visitor-based interfeace. Can stream from files, URLs
or iterators.
When writing JSON data, json-stream can stream JSON objects
as you generate them.
These techniques allow you to reduce memory consumption and
latency.
Reading
json-stream is a JSON parser just like the standard library's
json.load(). It
will read a JSON document and convert it into native python types.
import json_stream
data = json_stream.load(f)
Features:
stream all JSON data types (objects, lists and simple types)
stream nested data
simple pythonic list-like/dict-like interface
stream truncated or malformed JSON data (up to the first error)
native code parsing speedups for most common platforms
pure python fallback if native extensions not available
Unlike json.load(), json-stream can stream JSON data from any file-like or
it
|