Simple implementation of the json-pointer spec
Project description
JSON Pointer
Simple implementation of the json-pointer spec:
Usage
JSON pointer make it possible to retrieve arbitrary sub-objects from json objects.
>>> import json_pointer >>> data = {'a': {'b': 'c'}, 'd': ['e', 'f', 'g']}
>>> json_pointer.Pointer('/a/b').get(data) 'c' >>> json_pointer.Pointer('/d/1').get(data) 'f'
It is also possible to set and unset data using pointers.
>>> data = {'a': {'b': 'c'}, 'd': ['e', 'f', 'g']}
>>> json_pointer.Pointer('/a/b').set('d') >>> json_pointer.Pointer('/a/c').set('h') >>> data {'a': {'d': 'c', 'c': 'h'}, 'd': ['e', 'f', 'g']}
>>> json_pointer.Pointer('/d/1').unset(data) {'a': {'d': 'c', 'c': 'h'}, 'd': ['f', 'g']}
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
json_pointer-0.1.2.tar.gz
(3.2 kB
view details)
File details
Details for the file json_pointer-0.1.2.tar.gz
.
File metadata
- Download URL: json_pointer-0.1.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcc02765958406430cd0873160ff74178ab29cf9f5ebc012496ff23314df951f |
|
MD5 | a52e24e38a6439ccb8eef117f9e9d9d7 |
|
BLAKE2b-256 | 6198f4598c560918a3e4ed8e21926c40865fc65927aa50bb6c7bf94c5084b8c5 |