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 flatten_json

# Sample JSON data
data={
  "cat": [
    {
      "fish": "tuna"
    },
    {
      "chicken": 3
    },
    {
      "medicine": {
        "pills": 20
      }
    }
  ]
}
# returns a flattened json 
# {"_cat_0_fish": "tuna",  "_cat_1_chicken": 3,"_cat_2_medicine_pills": 20}
'''
print(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.8.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple_flatten_json-0.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 a60a40716cff520e1bff7a77d11cacacec8c94858aa21284d45ede6b5cd45a61
MD5 518d6019dd7678f433467d2c663070c3
BLAKE2b-256 f7fab9065ba5ed9272bef74f996f5d7b35345078fb787e018c87ac317637e6e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_flatten_json-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 647fefdcdf508ee7ff8dcc87a51820724e64aa36b2f36334c8e30582c18d7770
MD5 b378c9e8d361b691a2d69a5384848cea
BLAKE2b-256 2714845ead9274518a67628bcae124f8e3527f8b1cf62d9ba3d4733dece0dc70

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