Convert json-stream objects to standard Python dicts and lists
Project description
⚠ NOTE: Starting at json-stream 2.2.0,to_standard_types
is part of
json-stream itself, so there
is no longer a need for this packgage.
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 apply the 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]
License
Do whatever you want with it license or whatever it was called
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
File details
Details for the file json_stream_to_standard_types-0.1.4.tar.gz
.
File metadata
- Download URL: json_stream_to_standard_types-0.1.4.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36b50de33149f469d344d6852cb91a714d2d439433216200cee6ea00ffa7ee70 |
|
MD5 | 0c907a24a10dfd03367a0cf6cba45766 |
|
BLAKE2b-256 | 6742aadf9f11d800a0b53a109ac74dffa135d39143140baec72c7cef98001896 |