Skip to content

BilalAlpaslan/Pyonize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyonize

convert json|dict to python object

Setup

pip install pyonize

Examples

from pyonize import pyonize

deneme = pyonize({"id": 1, "name": "jhon", "job": {"id": 1, "title": "CTO"}, "list": [
                1, 2, 3], "dictlist": [{"name": "foo"}, {"name": "bar"}]})

print(deneme.name)
print(deneme.job)
print(deneme.job.title)

from pyonize import Pyon

class Foo(Pyon):
    def bar(self):
        ...

data = {"id": 1, "name": "jhon", "job": {"id": 1, "title": "CTO"},
    "list": [1, 2, 3], "dictlist": [{"name": "foo"}, {"name": "bar"}]}

foo = Foo(data)

print(foo.id)
print(foo.dictlist[1].name)