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 CircleCI 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 querystring 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(d)
{'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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

json_flatten-0.1-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

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