Skip to main content

Explore nested structures -- dictionaries and lists

Project description

NestView

Explore nested structures in Python at various levels of granularity.

Examples

from nestview import nestview

    from nestview import nestview


    nested_struct = {
        "orders": [
            {
                "id": "id1",
                "quantity": 43,
                "product": {
                    "id": "prodId1",
                    "name": "Prod 1",
                    "desc": "Description",
                },
            },
            {
                "id": "id2",
                "quantity": 12,
                "product": {
                    "id": "prodId1",
                    "name": "Prod 1",
                    "desc": "Description",
                },
            },
            {
                "id": "id3",
                "quantity": 3,
                "product": {
                    "id": "prodId2",
                    "name": "Prod 2",
                    "desc": "Description",
                },
            },
            {
                "id": "id4",
                "quantity": 2,
                "product": {
                    "id": "prodId1",
                    "name": "Prod 1",
                    "desc": "Description",
                },
            },
            {
                "id": "id5",
                "quantity": 4,
                "product": {
                    "id": "prodId1",
                    "name": "Prod 1",
                    "desc": "Description",
                },
            },
        ]
    }


    print(nestview(nested_struct))

gives

{'orders': '[25]'}

For the same structure with more details:

print(nestview(nested_struct, level=2))

gives

{'orders': ['{5}', '{5}', '{5}', '{5}', '{5}']}

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 nestview, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size nestview-0.1.1-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nestview-0.1.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

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