Skip to main content

Build Status Coverage Status

dict_dot_notate

dict_dot_notate turns nested dictionary keys to dotted strings with their corresponding values into a basic dictionary.

Installation

pip install dict-dot-notate

Usage

from dot_notate.dot import dict_dot_notate

Example

data = {
"obj": "obj",
"nested_once": {"first": "first"},
"nested_twice": {
    "twice": {"inner_nest": {"second": "second"}}
},
"nested_thrice": {
    "thrice": {"second_nest": {"tripple_nest": {"tripple": "thrice"}, "three": "three"}}
}
}

call the relevant method to convert our dict

    result = dict_dot_notate(data)

output

  {
    'obj': 'obj',
    'nested_once.first': 'first',
    'nested_twice.twice.inner_nest.second': 'second',
    'nested_thrice.thrice.second_nest.tripple_nest.tripple': 'thrice', 
    'nested_thrice.thrice.second_nest.three': 'three'
    }

If a dict passed in has a list value, Then the output will be as below

Example

data = {
"obj": "obj",
"nested_once": {"first": "first"},
"nested_twice": {
    "twice": {"inner_nest": [1, 2, 3, 4, 5]}
}
}

conversion

result = dict_dot_notate(data)

output

{
'obj': 'obj',
'nested_once.first': 'first',
'nested_twice.twice.inner_nest': [1, 2, 3, 4, 5]
}

Don't pass in a list of dictionaries.

Metadata

Release files for dict-dot-notate 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dict-dot-notate 0.0.3
File Size Uploaded
dict-dot-notate-0.0.3.tar.gz 2.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dict-dot-notate 0.0.3
File Interpreter ABI Platform
dict_dot_notate-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / dict-dot-notate-0.0.3.tar.gz

Download URL dict-dot-notate-0.0.3.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
efe8bb3221ffe5c23d0b03429daa01bc1923788c982d5630da011ac3a471fa5d
BLAKE2b-256 checksum
How to use checksums
9e13321f3ef38488217d26395af26a009fa6e2a6a9400544649ae214070b61b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.5

Release files / dict_dot_notate-0.0.3-py3-none-any.whl

Download URL dict_dot_notate-0.0.3-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1da0de5611aaabbdc3535d0f053cb1e5cf396c54941993815b3c085073c37a9d
BLAKE2b-256 checksum
How to use checksums
839e046d6b801207654029482ec4ad806df0a59bab565538f3972ff4d715f6a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page