Skip to main content

Json package

Project description

Json Uts

Installation

pip install jsonUts

GitHub

https://github.com/ZdekPyPi/JsonUts

Usage

Json sample

my_json =  {
    "person":{
        "name":"json uts",
        "age": 30
    },
    "my cars":[
        {"pattern":"Ferrari","year":2015},
        {"pattern":"Lamborghini","year":2018}
    ],
    "job":"Software developer",
    "UpperCase":123,
    "with space":"lets go!"
}

simple transform

from jsonUts import jsonToObj

jsonO = jsonToObj(my_json)
#jsonO = jsonToObj(my_json,toLower=True)   # to convert all keys in lower case.
#jsonO = jsonToObj(my_json,trim_keys=True)   # remove white spaces from the start and end

print(jsonO.person.name)   
print(jsonO.job)           
print(jsonO.with_space)
print(jsonO.my_cars[0].pattern)

Reverse

#After creating you object (jsonO), you can use it

json_again           = jsonO.toJson()
json_again_original  = jsonO.toJson(original_keys=True) # if you want your original key names back
'2022-05-25'

Change Log

0.0.1 (2024-04-19)

  • First Release

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

jsonUts-1.0.3.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

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