Skip to main content

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


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.4.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

jangli-1.1.4-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file jangli-1.1.4.tar.gz.

File metadata

  • Download URL: jangli-1.1.4.tar.gz
  • Upload date:
  • Size: 2.5 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

Hashes for jangli-1.1.4.tar.gz
Algorithm Hash digest
SHA256 30bb723b1fdfe8774bf246cbe41a2295f7f908e2cf7c9b157f920a363b663060
MD5 e55cf69776c8d6d48f8e2e33ebd48936
BLAKE2b-256 88e0a6ceb37327c26144d438ec0ab09d49836499d944a69130ae2ad7a76217c9

See more details on using hashes here.

File details

Details for the file jangli-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: jangli-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.8 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

Hashes for jangli-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 24a04240a13e0fadb16b9e8f43488f55bcbb871286b9e8c45f98850f14d9e7ed
MD5 5e803b4354dc9b2b3235fd30ba6dd1d2
BLAKE2b-256 3f27334e63868d490141fec6661fdeb16e0b4165e98783af7f93ff23f26d9a8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page