Convert json-stream objects to standard Python dicts and lists
Project description
json-stream-to-standard-types
Utility function to convert json-stream
objects to normal Python dicts/lists.
Parallel PR: https://github.com/daggaz/json-stream/pull/17
Installation
pip install json-stream-to-standard-types
Usage
To convert a json-stream dict
-like or list
-like object and all its
descendants to a standard list
and dict
, simply appl apply library's
to_standard_types
function:
import json_stream
from json_stream_to_standard_types import to_standard_types
# JSON: {"round": 1, "results": [1, 2, 3]}
data = json_stream.load(f)
results = data["results"]
print(results) # prints <TransientStreamingJSONList: TRANSIENT, STREAMING>
converted = to_standard_types(results)
print(converted) # prints [1, 2, 3]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for json-stream-to-standard-types-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43a321becb9d3225e7d0500d60f34c9c20424cb436df6c8f277aa29bfaae7b64 |
|
MD5 | 15096a5fedac2795c6ce8ad6595d0d65 |
|
BLAKE2b-256 | 7b322f840df42d5455f7a6254e36ec3b8cfe6f37c0bb026066720de34afe8883 |
Close
Hashes for json_stream_to_standard_types-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91eca13a9fd9959005b1bcd6b44524fed3405646b25827403c9ae10d7b4f4aa8 |
|
MD5 | 82af7f7a1319c1bdf68af6e4f92be35f |
|
BLAKE2b-256 | c8f7e347c5b4b31bdc50eb33e518000f82940fb6e252334782dd9739c56e5554 |