Data Object Mapping
Project description
Jangli
Scope
- Data Definition
- Data mapping
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)
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)
Custom object list
class A:
def __init__(self, b):
self.b = b
lt = ListObject(A)
lt.append(A(7))
lt.insert(1, A(8))
print(lt)
Output : [<__main__.A object at 0x00CA3730>, <__main__.A object at 0x00CC6E10>]
Case Change to CamelCase
from jangli.case_type import CamelCase
@CamelCase
class NewClass:
def __init__(self):
self.a = 7
self.b = "hi"
self.c = True
self._from = None
new = NewClass()
print(new.__dict__)
MIT License : Copyright (c) 2019 Abhimanyu Haralukallu
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.1.2.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file jangli-1.1.2.tar.gz
.
File metadata
- Download URL: jangli-1.1.2.tar.gz
- Upload date:
- Size: 2.3 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 |
79bba3400bcde22a099965ff7c1226a9936e85134bdedd9a421fd028a464f1c4
|
|
MD5 |
b11e0a31e954c09b2ed200aa7ca52eee
|
|
BLAKE2b-256 |
198d8b002ae3981d0026e8e894d9a4d12b8bb69e53d2f238cd9b4687d8b86762
|
File details
Details for the file jangli-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: jangli-1.1.2-py3-none-any.whl
- Upload date:
- Size: 3.7 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 |
e2d3d28a661de0dd6f7ac7209a6d18c33892f0c8cdfdff3d8b7367eee36e22fe
|
|
MD5 |
66ddf4c1957a4d2878fe9c94fea73b29
|
|
BLAKE2b-256 |
250f1bac7e6eaeffae603ce8effd8db1e745aa5e12428dcbd180f57d3dbb41ab
|