Skip to main content

A class for dot notation access to dictionaries

Project description

# DataChanger


DataChanger is a Python package that provides a class `DotDict` for dot notation access to dictionaries, lists, tuples, sets, and even JSON strings.

## Installation

You can install DataChanger via pip:

# Description
DataChanger is a Python package that provides a class DotDict,
which allows for dot notation access to nested dictionaries and json data with data
types like str, int, lists, tuples, and sets. It is especially useful for working
with JSON data and standard Python dictionaries in a more intuitive way.

Features:
- Written in Cython which gives this code 10X speed than python.
- Dot notation access for dictionaries and json.
- Supports deeply nested data structures, such as JSON and Python dictionaries.
- Converts JSON strings directly to DotDict, without the need to first convert to a dictionary.
- Allows for seamless conversion back to standard Python dictionaries.

Benefits:
- Simplifies working with deeply nested data by allowing dot notation (e.g., `data.key1.key2`).
- Eliminates the need for repetitive key lookups or dealing with nested dictionary keys manually.
- Faster and more efficient handling of JSON data by eliminating the intermediate step of converting JSON to dict before conversion to DotDict.

Usage:
1. Convert a standard dictionary or JSON string to a DotDict:
- Using a dictionary:
```python
from dictator.dot_dict import DotDict
my_dict = {'key1': {'key2': 'value'}}
dot_dict = DotDict(my_dict)
print(dot_dict.key1.key2) # Output: value
```
- Using a JSON string:
```python
json_str = '{"key1": {"key2": "value"}}'
dot_dict = DotDict(json_str)
print(dot_dict.key1.key2) # Output: value
```

2. Convert back to a dictionary:
```python
dict_rep = dot_dict.to_dict()
print(dict_rep) # Output: {'key1': {'key2': 'value'}}
```

3. Stop raising error if key is not present in dict:
```
dot_dict = DotDict(my_dict, raise_error=False)
```

4. Convert nested iterables to list:
```
dot_dict = DotDict(my_dict, convert_iterables=False)
```

This package makes working with nested data more intuitive and readable,
especially when handling complex JSON objects or deeply nested dictionaries.

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

datachanger-0.1.4.tar.gz (78.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

DataChanger-0.1.4-cp312-cp312-win_amd64.whl (35.5 kB view details)

Uploaded CPython 3.12Windows x86-64

File details

Details for the file datachanger-0.1.4.tar.gz.

File metadata

  • Download URL: datachanger-0.1.4.tar.gz
  • Upload date:
  • Size: 78.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for datachanger-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8c3d4c4d0e563d6fab12964a2268722a7fb7ca7de32a06a030f8be059f3b0009
MD5 5056d3710240810f91fb918ac9801e07
BLAKE2b-256 4bbf5f9d270bdfef0ba19f4535c4c6fde0c0fc15d2063132b11fbb3964759a9d

See more details on using hashes here.

File details

Details for the file DataChanger-0.1.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for DataChanger-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 234b2f8b1567fdcf796d831766455c999d50795c5a31adfcc7675fab33eb7dfd
MD5 cac5d57ae504055d6d8b1af57d4dc6bd
BLAKE2b-256 44fb38873a5ce35d379bc6fff5b603770fc9534b2572fbd654dbd3b5baf43b7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page