Skip to main content

Simple implementation of the json-pointer spec

Project description

https://drone.io/bitbucket.org/eodolphi/json-pointer/status.png

JSON Pointer

Simple implementation of the json-pointer spec:

http://tools.ietf.org/html/rfc6901

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
json_pointer-0.1.2.tar.gz (3.2 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page