Skip to content

A package to deserialize and serialize json files.

License

Notifications You must be signed in to change notification settings

TAFH-debug/jsonpython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A package to deserialize and serialize json files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages