Skip to main content

For flattening complex JSONs

Project description

Usage

simple_json_flatten_py is a Python library for flattening complex JSONs

From

{
"a": [ {"b":37},{"c":64}],
"g": 26
}

To

{
  "a_b":37,
  "a_c":64,
  "g":26
}
from simple_flatten_json_py import simple_flatten_json

# Sample JSON data
data={
   "cat":[
      {
         "fish":"tuna"
      },
      {
         "chicken":3
      },
      {
         "medicine":{
            "pills":5
         }
      }
   ]
}
# returns a flattened json 
# {"cat_0_fish": "tuna",  "cat_1_chicken": 3,"cat_2_medicine_pills": 20}

print(simple_flatten_json.flatten_json(data))

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

simple_flatten_json-0.0.9.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

simple_flatten_json-0.0.9-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file simple_flatten_json-0.0.9.tar.gz.

File metadata

  • Download URL: simple_flatten_json-0.0.9.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for simple_flatten_json-0.0.9.tar.gz
Algorithm Hash digest
SHA256 1fbc1f2760edc7693b01093408c8a7bba8668a9df2c24d36beeda14e49f00e1c
MD5 82b95d3afd862c94b18c7a4f49ba8a7c
BLAKE2b-256 10d3be2f6043efff97bd25fa68fec7cbb7d8969f3cc5c897a609bce7bbee537a

See more details on using hashes here.

File details

Details for the file simple_flatten_json-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_flatten_json-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f30b84205aa8bd13d1e5bdfbebac8f3bcaa358e724afce5821fdfd7b4be0fdfa
MD5 f5ce08bbf13f4e51312cc91b0c3d757e
BLAKE2b-256 373bfc9fd53b0061efaa4e0835d4f5c8c56f28874b80901631c31364a856069e

See more details on using hashes here.

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