Skip to main content

Simple JSON Lib

Project description

JsonSimple

JsonSimple demo:

from JsonSimple import JsonSimple


js = JsonSimple('{"code":0,"data":{"total":2,"list":[{"id":1,"name":"zhang_san","0":"a"},{"id":2,"name":"li"}]}}')
data = js.data.list._0.__0  # noqa
print(data)
# a
data = js.data.list._0.name  # noqa
print(data)
# zhang_san
data = js.get_value('data.list.0.0')
print(data)
# a

js.set_value('data.list.0.50', '5455555')
print(js)
# {"code": 0, "data": {"total": 2, "list": [{"id": 1, "name": "zhang_san", "0": "a", "50": "5455555"}, {"id": 2, "name": "li"}]}}
js.set_value('data.list.0.new_field.name', 'new_name')
print(js)
# {"code": 0, "data": {"total": 2, "list": [{"id": 1, "name": "zhang_san", "0": "a", "50": "5455555", "new_field": {"name": "new_name"}}, {"id": 2, "name": "li"}]}}

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

JsonSimple-0.0.0.3.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file JsonSimple-0.0.0.3.tar.gz.

File metadata

  • Download URL: JsonSimple-0.0.0.3.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for JsonSimple-0.0.0.3.tar.gz
Algorithm Hash digest
SHA256 18adf5f6fabc7a0067f8ed8471b0ac8eadb390e063e1c26ef3c7d355bd49c5a9
MD5 3681d08a63c0c3799d765c0694391100
BLAKE2b-256 5d2283c8b536d8dbc67aa2ee0b5dd54261fba88059b6138ca56648af19f075cd

See more details on using hashes here.

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