Data Object Mapping
Project description
Jangli
Scope
- Data Definition
- Data mapping
Convert json to python object.
from jangli.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 jangli.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
from jangli.list_of_object import ListObject
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.3.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file jangli-1.1.3.tar.gz
.
File metadata
- Download URL: jangli-1.1.3.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 |
02f498083c4696e8cc023271016546d3c2a7084340c825c203d53776ba82371d
|
|
MD5 |
aff0c160e215c4e7e540858fdc51fc28
|
|
BLAKE2b-256 |
72e5777a271356dca2ab7dde29e884bcae960d8e8e6fbe42dd8f89180e4c37a4
|
File details
Details for the file jangli-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: jangli-1.1.3-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 |
51f7a4bb9d49e5bf5aa1f4e649cb8f9e94eb918fb2121ce1641738bca51c0cee
|
|
MD5 |
3931d9fd54a32937200f9c41ae3f71d4
|
|
BLAKE2b-256 |
eb9b28661e8a1e0a7b8dce2877ad0393bb92b7c5a8b77b6bece533a9b14e4740
|