Skip to main content

Data Object Mapping

Project description

Jangli

Scope

  • Data Definition
  • Data mapping

[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)

[3] 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>]

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

Uploaded Source

Built Distribution

jangli-1.1.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for jangli-1.1.1.tar.gz
Algorithm Hash digest
SHA256 62881a78f088782577b323ef9857fa882f4a73c1958d03e7e27bbb66b2438e33
MD5 be1d32c5a2b16b5deedbb5e85911cd56
BLAKE2b-256 b918fa22eb9ec4e4ba69c49fb776143fe1f31db3d01e688735f3e784a78160fc

See more details on using hashes here.

File details

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

File metadata

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

Hashes for jangli-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f68108a2a4208ddfb9e0daba36022274b97cbce79f9493b88498c0293b3b0df0
MD5 6267a39184191e954ed9203cccf61675
BLAKE2b-256 79f92e08c6399934a52e1e40daded670943f74dd7a4eca05a15df04ead0ba650

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