{"id":17465015,"url":"https://github.com/erdogant/dicter","last_synced_at":"2025-07-27T17:09:23.848Z","repository":{"id":65148923,"uuid":"584101058","full_name":"erdogant/dicter","owner":"erdogant","description":"Python package with advanced dictionary functions. Traverse through nested dicts. Set and get multiple keys. Flattens dicts. Store and load in json and more!","archived":false,"fork":false,"pushed_at":"2025-04-24T19:33:40.000Z","size":6997,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T09:04:26.066Z","etag":null,"topics":["compare","compare-data","dictionary","flatten","json","load","nested","save","traversal"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erdogant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["erdogant"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-01-01T11:15:46.000Z","updated_at":"2025-04-24T19:33:44.000Z","dependencies_parsed_at":"2025-03-02T22:20:03.133Z","dependency_job_id":"a0c0211b-ae05-4d39-833b-964c49a044e2","html_url":"https://github.com/erdogant/dicter","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/erdogant/dicter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fdicter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fdicter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fdicter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fdicter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdogant","download_url":"https://codeload.github.com/erdogant/dicter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fdicter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267009809,"owners_count":24020677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compare","compare-data","dictionary","flatten","json","load","nested","save","traversal"],"created_at":"2024-10-18T11:08:28.534Z","updated_at":"2025-07-27T17:09:23.843Z","avatar_url":"https://github.com/erdogant.png","language":"Python","funding_links":["https://github.com/sponsors/erdogant","https://www.buymeacoffee.com/erdogant)--","https://www.buymeacoffee.com/erdogant","https://img.buymeacoffee.com/button-api/?text=Buy"],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://erdogant.github.io/dicter/\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/dicter/blob/main/docs/figs/logo.png\" width=\"400\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n[![Python](https://img.shields.io/pypi/pyversions/dicter)](https://img.shields.io/pypi/pyversions/dicter)\n[![Pypi](https://img.shields.io/pypi/v/dicter)](https://pypi.org/project/dicter/)\n[![Docs](https://img.shields.io/badge/Sphinx-Docs-Green)](https://erdogant.github.io/dicter/)\n[![LOC](https://sloc.xyz/github/erdogant/dicter/?category=code)](https://github.com/erdogant/dicter/)\n[![Downloads](https://static.pepy.tech/personalized-badge/dicter?period=month\u0026units=international_system\u0026left_color=grey\u0026right_color=brightgreen\u0026left_text=PyPI%20downloads/month)](https://pepy.tech/project/dicter)\n[![Downloads](https://static.pepy.tech/personalized-badge/dicter?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=brightgreen\u0026left_text=Downloads)](https://pepy.tech/project/dicter)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/erdogant/dicter/blob/master/LICENSE)\n[![Forks](https://img.shields.io/github/forks/erdogant/dicter.svg)](https://github.com/erdogant/dicter/network)\n[![Issues](https://img.shields.io/github/issues/erdogant/dicter.svg)](https://github.com/erdogant/dicter/issues)\n[![Project Status](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)\n[![DOI](https://zenodo.org/badge/584101058.svg)](https://zenodo.org/badge/latestdoi/584101058)\n![GitHub Repo stars](https://img.shields.io/github/stars/erdogant/dicter)\n![GitHub repo size](https://img.shields.io/github/repo-size/erdogant/dicter)\n[![Donate](https://img.shields.io/badge/Support%20this%20project-grey.svg?logo=github%20sponsors)](https://erdogant.github.io/dicter/pages/html/Documentation.html#)\n\u003c!---[![BuyMeCoffee](https://img.shields.io/badge/buymea-coffee-yellow.svg)](https://www.buymeacoffee.com/erdogant)--\u003e\n\u003c!---[![Coffee](https://img.shields.io/badge/coffee-black-grey.svg)](https://erdogant.github.io/donate/?currency=USD\u0026amount=5)--\u003e\n\n\n* ``dicter`` is Python package with advanced dictionary functions:\n\n\t* Traverse through nested dicts to retrieve key-path.\n\t* Set value in dictionary using key-path\n\t* Get value in dictionary using key-path.\n\t* Flattens dicts.\n\t* Compare two dicts.\n\t* Store and load in json.\n\n\n\n# \n**Star this repo if you like it! ⭐️**\n#\n\n## Documentation\n\n* [**dicter documentation pages (Sphinx)**](https://erdogant.github.io/dicter/)\n\n\n## Installation\n* Install dicter from PyPI (recommended). dicter is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows. \n* A new environment can be created as following:\n\n\n```bash\npip install -U dicter\n```\n\n* Alternatively, you can install from the GitHub source:\n```bash\n# Directly install from github source\npip install git+https://github.com/erdogant/dicter\n```\n\n## Examples\n\n#### Import dicter package\n```python\nimport dicter as dt\n```\n\n#### Traverse all paths in dictionary.\n```python\nimport dicter as dt\n # Example dict:\nd = {'level_a': 1, 'level_b': {'a': 'hello world'}, 'level_c': 3, 'level_d': {'a': 1, 'b': 2, 'c': {'e': 10}}, 'level_e': 2}\n# Walk through dict to get all paths\npaths = dt.traverse(d)\n\nprint(paths)\n# [[['level_a'], 1],\n# [['level_c'], 3],\n# [['level_e'], 2],\n# [['level_b', 'a'], 'hello world'],\n# [['level_d', 'a'], 1],\n# [['level_d', 'b'], 2],\n# [['level_d', 'c', 'e'], 10]]\n```\n\n#### Get value from dictionary using nested keys.\n```python\n# Import dicter\nimport dicter as dt\n\n# Example dictionary\nd = {'level_a': 1, 'level_b': {'a': 'hello world'}, 'level_c': 3, 'level_d': {'a': 1, 'b': 2, 'c': {'e': 10}}, 'level_e': 2}\n# Get the value for the nested path for:\nvalue = dt.get_nested(d, key_path=[\"level_b\", \"a\"])\nprint(value)\n# 'hello world'\n\n```\n\n#### Set value from dictionary using nested keys.\n```python\n# Import dicter\nimport dicter as dt\n\n# Example: New path and value in dictionary.\nd = {}\nkey_path = ['person', 'address', 'city']\ndt.set_nested(d, key_path, 'New York')\n# Print updated dictionary\nprint(d)\n# {'person': {'address': {'city': 'New York'}}}\n\n```\n\n#### Set value from dictionary using nested keys.\n```python\n# Import dicter\nimport dicter as dt\n\n# Example dict\nd = {'level_a': 1, 'level_b': {'a': 'hello world'}, 'level_c': 3, 'level_d': {'a': 1, 'b': 2, 'c': {'e': 10}}, 'level_e': 2}\n# Flatten dictionary\ndflat = dt.flatten(d)\n\nprint(d_flat)\n\n# [['level_a', 1],\n#  ['a', 'hello world'],\n#  ['level_c', 3],\n#  ['a', 1],\n#  ['b', 2],\n#  ['e', 10],\n#  ['level_e', 2]]\n \n```\n\n\n#### Depth of dictionary.\n```python\n# Import dicter\nimport dicter as dt\n\nd = {'level_a': 1, 'level_b': {'a': 'hello world'}, 'level_c': 3, 'level_d': {'a': 1, 'b': 2, 'c': {'e': 10}}, 'level_e': 2}\nn = dt.depth(d)\n\n```\n\n#### Compare dictionary.\n```python\n# Import dicter\nimport dicter as dt\n\nExample: Add\nd1 = {'level_a': 1, 'level_b': {'a': 'hello world'}, 'level_c': 'new in d2'}\nd2 = {'level_a': 1, 'level_b': {'a': 'hello world'}}\nout = dt.compare(d1, d2)\nprint(out)\n\nExample: Remove\nd1 = {'level_a': 1, 'level_b': {'a': 'hello world'}}\nd2 = {'level_a': 1, 'level_b': {'a': 'hello world'}, 'level_c': 'new in d2'}\nout = dt.compare(d1, d2)\nprint(out)\n\nExample: Modified\nd1 = {'level_a': 1, 'level_b': {'a': 'hello world'}}\nd2 = {'level_a': 1, 'level_b': {'a': 'modified'}}\nout = dt.compare(d1, d2)\nprint(out['modified'])\n\n```\n\n#### Save and load dictionary.\n```python\n\n# Import dicter\nimport dicter as dt\n\nd = {'level_a': None, 'level_b': {'a': 'hello world'}, 'level_c': True, 'level_d': 2.3, 'level_e': [[1,2,3], [1,2]]}\nfilepath='c:/temp/test/dicter_save.json'\n\n# First save\ndt.save(d, filepath=filepath, overwrite=True)\n\n# Load\nd = dt.load(filepath)\n```\n#\n\n#### Citation\nPlease cite in your publications if this is useful for your research (see citation).\n   \n#### ☕ Support\n\nIf you find this project useful, consider supporting me:\n\n\u003ca href=\"https://www.buymeacoffee.com/erdogant\"\u003e\n  \u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee\u0026emoji=\u0026slug=erdogant\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Cookie\u0026outline_colour=000000\u0026coffee_colour=ffffff\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdogant%2Fdicter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdogant%2Fdicter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdogant%2Fdicter/lists"}