Skip to main content

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

json-stream-to-standard-types-0.1.0.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page