https://github.com/davidsantana06/flex-object
A Python class for dynamic attributes, JSON serialization, and parsing.
https://github.com/davidsantana06/flex-object
json python
Last synced: about 1 year ago
JSON representation
A Python class for dynamic attributes, JSON serialization, and parsing.
- Host: GitHub
- URL: https://github.com/davidsantana06/flex-object
- Owner: davidsantana06
- License: mit
- Archived: true
- Created: 2023-08-06T22:05:53.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-06T17:42:40.000Z (over 2 years ago)
- Last Synced: 2025-03-12T10:11:54.909Z (over 1 year ago)
- Topics: json, python
- Language: Python
- Homepage: https://pypi.org/project/flex-object/
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FlexObject
The FlexObject redefines your Python programming experience with its versatile base class, offering an array of dynamic attribute management capabilities, seamless runtime attribute manipulation, effortless JSON serialization, and streamlined JSON file/string handling. This library serves as a cornerstone for simplified data interaction, catering to a wide spectrum of scenarios.
> **Note**
> This project has been developed based on Python 3.6 or above.
## :rocket: Features
1. **Dynamic Attribute Management**: Enjoy the freedom to effortlessly manage object attributes on-the-fly, enhancing adaptability to evolving requirements.
2. **Runtime Attribute Addition/Removal**: Streamline your workflow by dynamically adding or removing attributes during execution, minimizing disruptions.
3. **JSON Serialization**: Seamlessly transform object attributes into the JSON format, facilitating convenient storage, sharing, or communication with external systems.
4. **JSON File/String Reading**: Effortlessly load object attributes from JSON files or strings, expediting data retrieval and utilization.
## :coffee: Usage
After incorporating FlexObject into your project, the usage will follow the steps outlined below.
```Python
from flex_object import FlexObject
# Create a FlexObject instance
flex_obj = FlexObject()
# Set attributes dynamically
flex_obj.set(name='David Santana', github='davidsantana06', age=21)
# Serialize attributes to JSON string
json_str = flex_obj.dumps_json()
# Deserialize attributes from JSON string
flex_obj.loads_json(json_str)
# Store attributes in a JSON file
flex_obj.dump_json('data.json')
# Load attributes from a JSON file
flex_obj.load_json('data.json')
```
## :balance_scale: License
This project adopts the **MIT License**, which allows you to use and make modifications to the code as you wish. The only thing I ask is that proper credit is given, acknowledging the effort and time I invested in building it.