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
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.
Source Distribution
json-flatten-0.2.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for json_flatten-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5f1bb57d4599e41216974b5e04d15ce32ec77e985f58399e3a7da46ef365331 |
|
MD5 | 6b881ff79b2facd21dd30c03226b6c32 |
|
BLAKE2b-256 | 3a292efc524c8be4dbe21eaf98aa375a8fd9d80b3cc59b2f3e9dbb76483015a6 |