Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liangbaika/jsonfy
Json与Python对象的双向绑定(jsonfy) Jsonfy: Lightweight two-way binding of JSON and object without third-party dependency
https://github.com/liangbaika/jsonfy
conevrt json python
Last synced: 12 days ago
JSON representation
Json与Python对象的双向绑定(jsonfy) Jsonfy: Lightweight two-way binding of JSON and object without third-party dependency
- Host: GitHub
- URL: https://github.com/liangbaika/jsonfy
- Owner: liangbaika
- License: bsd-3-clause
- Created: 2020-01-17T06:11:07.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-30T07:43:27.000Z (almost 5 years ago)
- Last Synced: 2024-10-10T05:37:09.809Z (about 1 month ago)
- Topics: conevrt, json, python
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.rst
Awesome Lists containing this project
README
## 1. Jsonfy: Lightweight two-way binding of JSON and object without third-party dependency
## 2. pip install jsonfy
## 3. How to use? you can see examples or Quick start
## 4. Welcome to submit your code and comments to a better Jsonfy
## 5. Quick start:
```
import time
from datetime import datetime
from cn.jsonfy.core import DateTimeDesc, BaseJsonModel, DictDescclass Foo(BaseJsonModel):
infos1 = DictDesc("infos1")
up = DateTimeDesc("up", format='%Y-%m-%d')
down = DateTimeDesc("down")
if __name__ == '__main__':
f = Foo()
_fake_time = datetime.now()
f.up = _fake_time
f.down = _fake_time
_dict = {"key": "value"}
f.infos1 = _dict
print(f.toJson())
f_obj = f.fromJson(f.toJson())
print(f_obj)
```