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__)
String of None to None
from jangli.checker.none_checker import NoneChecker
@NoneChecker
class A:
def __init__(self):
self.b = 8
self.c = "None"
self.d = True
print(A().__dict__)
>>> {'b': 8, 'c': None, 'd': True}
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.5.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file jangli-1.1.5.tar.gz
.
File metadata
- Download URL: jangli-1.1.5.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.19.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6700bbf4250153b2776f14aae791d5b6761b88e62ecfa086b39afd8c2542d128
|
|
MD5 |
659c3378ad833066443a7015784062ab
|
|
BLAKE2b-256 |
d218a47ae2be011a7f041590e5d45d9e9aa206f5e8799bb1380928bd0884a054
|
File details
Details for the file jangli-1.1.5-py3-none-any.whl
.
File metadata
- Download URL: jangli-1.1.5-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.19.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6a223f6790bb26a26311e8a19e07c88a69c1e2d582170e91284fe1799c17e1eb
|
|
MD5 |
1e7de1042c75834f3ae1423345228f5a
|
|
BLAKE2b-256 |
9af161a5b3d47220f7c8a0e9ab869949b7083a5dd8efdf8632dec4ee1bfa82eb
|