Skip to main content

Python functions for flattening a JSON object to a single dictionary of pairs, and unflattening that dictionary back to a JSON object

Project description

json-flatten

PyPI Changelog Tests License

Python functions for flattening a JSON object to a single dictionary of pairs, and unflattening that dictionary back to a JSON object.

Useful if you need to represent a JSON object using a regular HTML form or transmit it as a set of query string parameters.

For example:

>>> json_flatten.flatten({"foo": {"bar": [1, True, None]}})
{'foo.bar.0$int': '1', 'foo.bar.1$bool': 'True', 'foo.bar.2$none': 'None'}
>>> json_flatten.unflatten(_)
{'foo': {'bar': [1, True, None]}}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for json-flatten, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size json_flatten-0.2-py3-none-any.whl (3.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size json-flatten-0.2.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page