A package to deserialize and serialize json files.
Project description
Jsonpython
A package to deserialize and serialize json.
Installing:
pip install jsonpython
Example:
data.json
{
"name": "Alex",
"age": 23,
"car": {
"model": "Tesla X",
"cost": 40000,
"company": {
"name": "Tesla"
}
}
}
main.py
from jsonpython import *
jobj = get_json_object("data.json")
print(jobj['name']) # Alex
print(jobj['car']['model']) # Tesla X
class Company:
name: str
class Car:
model: str
cost: int
company: Company
class Person:
age: int
name: str
car: Car
person = from_file(Person, "data.json")
print(person.car.model) # Tesla X
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
jsonpython-0.0.8.tar.gz
(4.0 kB
view details)
File details
Details for the file jsonpython-0.0.8.tar.gz.
File metadata
- Download URL: jsonpython-0.0.8.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f1149663ee567c38c26a39977476a504b72111bac1ff634fad1df08a8a8727
|
|
| MD5 |
9da61857c703c3173b8b1be6c2747507
|
|
| BLAKE2b-256 |
4df7ca5a5945191415a1846983bdb10274b48e104e2162f00f1e370f669afafd
|