Convert json to python object and vice versa
Project description
Json_Object_Conv
[1] Convert json to python object.
from json_utils.json_to_object import json_to_obj
data = '{"password": "123456", "id": 1, "name": "abhimanyu"}'
class Student:
def __init__(self):
self.id = None
self.name = None
self.password = None
s = json_to_obj(data, Student)
print(s.name)
[2] Convert json to python object.
from json_utils.json_to_object import json_to_obj
data_2 = '{"password": "123456", "id": 1, "name": "abhimanyu", "school" : "SOHS"}'
class Student:
school = None
def __init__(self):
self.id = None
self.name = None
self.password = None
s2 = json_to_obj(data_2, Student)
print(s2.school)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jangli-1.0.0.tar.gz
(1.4 kB
view details)
Built Distribution
File details
Details for the file jangli-1.0.0.tar.gz
.
File metadata
- Download URL: jangli-1.0.0.tar.gz
- Upload date:
- Size: 1.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.7.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ab2a70a3c189bd936776508677c13fc3aecd5de2881e74a2b47f08267ece974e
|
|
MD5 |
fccb3729e7da7cf7abc96b7a68a6d017
|
|
BLAKE2b-256 |
258a64bb51287b4ab489068c1e4d5d434b84cca6fd2dc2a00cb5bfa0383a4c55
|
File details
Details for the file jangli-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: jangli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.7.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
fe45aeb8cb3eb592bbefea4a79d234367886c66080fa8889faf39ed160180b72
|
|
MD5 |
3955fc6ed5e48346aa4e91a5fdc2ec56
|
|
BLAKE2b-256 |
e436e437cb33629e4a2f3472dcc7988d3ff12a891d5474e7d3d4c6edc17c86e3
|