🌐
GitHub
github.com › stefankoegl › python-json-pointer › blob › master › doc › tutorial.rst
python-json-pointer/doc/tutorial.rst at master · stefankoegl/python-json-pointer
>>> from jsonpointer import resolve_pointer >>> obj = {"foo": {"anArray": [ {"prop": 44}], "another prop": {"baz": "A string" }}} >>> resolve_pointer(obj, '') == obj True >>> resolve_pointer(obj, '/foo') == obj['foo'] True >>> resolve_pointer(obj, '/foo/another prop') == obj['foo']['another prop'] True >>> resolve_pointer(obj, '/foo/another prop/baz') == obj['foo']['another prop']['baz'] True >>> resolve_pointer(obj, '/foo/anArray/0') == obj['foo']['anArray'][0] True >>> resolve_pointer(obj, '/some/path', None) == None True
Author   stefankoegl
🌐
Readthedocs
python-json-pointer.readthedocs.io › en › latest › tutorial.html
Tutorial — python-json-pointer 3.0.0 documentation
>>> from jsonpointer import resolve_pointer >>> obj = {"foo": {"anArray": [ {"prop": 44}], "another prop": {"baz": "A string" }}} >>> resolve_pointer(obj, '') == obj True >>> resolve_pointer(obj, '/foo') == obj['foo'] True >>> resolve_pointer(obj, '/foo/another prop') == obj['foo']['another prop'] True >>> resolve_pointer(obj, '/foo/another prop/baz') == obj['foo']['another prop']['baz'] True >>> resolve_pointer(obj, '/foo/anArray/0') == obj['foo']['anArray'][0] True >>> resolve_pointer(obj, '/some/path', None) == None True
🌐
GitHub
github.com › stefankoegl › python-json-pointer
GitHub - stefankoegl/python-json-pointer: Resolve JSON Pointers in Python
Library to resolve JSON Pointers according to RFC 6901
Starred by 145 users
Forked by 42 users
Languages   Python 98.8% | Makefile 1.2% | Python 98.8% | Makefile 1.2%
🌐
HotExamples
python.hotexamples.com › examples › jsonpointer › - › resolve_pointer › python-resolve_pointer-function-examples.html
Python resolve_pointer Examples, jsonpointer.resolve_pointer Python Examples - HotExamples
It is optional in rmr_context for # improved readability if self.rmr_context == '' or self.rmr_context.startswith('/'): pointer = self.rmr_context else: pointer = '/' + self.rmr_context # Note: if there is no match for pointer, resolve_pointer returns None return UserBaselineProposedVals( user = resolve_pointer(rmrs.user, pointer) if self.rmrs_used.user else None, baseline = resolve_pointer(rmrs.baseline, pointer) if self.rmrs_used.baseline else None, proposed = resolve_pointer(rmrs.proposed, pointer) if self.rmrs_used.proposed else None )
🌐
ProgramCreek
programcreek.com › python › example › 111493 › jsonpointer.resolve_pointer
Python Examples of jsonpointer.resolve_pointer
def __init__(self, directive, arguments, options, content, lineno, content_offset, block_text, state, state_machine): assert directive == 'jsonschema' #breakpoint() self.options = options self.state = state self.lineno = lineno self.statemachine = state_machine if len(arguments) == 1: filename, pointer = self._splitpointer(arguments[0]) if filename != '': self._load_external(filename) else: self._load_internal(content) if pointer: self.schema = resolve_pointer(self.schema, pointer) else: self._load_internal(content)
🌐
GitHub
github.com › stefankoegl › python-json-pointer › issues › 9
resolve_pointer() won't always return the default. · Issue #9 · stefankoegl/python-json-pointer
October 31, 2014 - In [1]: from jsonpointer import resolve_pointer In [2]: d = {'a': {'b': 'c'}} In [3]: resolve_pointer(d, '/a/b/d', None) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-3-5e4f54760a84> in <module>() ----> 1 resolve_pointer(d, '/a/b/d', None) /home/kafkaf/dev/python-json-pointer/jsonpointer.pyc in resolve_pointer(doc, pointer, default) 104 105 pointer = JsonPointer(pointer) --> 106 return pointer.resolve(doc, default) 107 108 def set_pointer(doc, pointer, value, inplace=True): /home/kafkaf/dev/python-json-poi
🌐
Readthedocs
python-json-pointer.readthedocs.io
python-json-pointer — python-json-pointer 3.0.0 documentation
python-json-pointer is a Python library for resolving JSON pointers (RFC 6901).
🌐
PyPI
pypi.org › project › jsonpointer
jsonpointer · PyPI
Python :: Implementation :: PyPy · Topic · Software Development :: Libraries · Utilities · Report project as malware · Library to resolve JSON Pointers according to RFC 6901 · See source code for examples · Website: https://github.com/stefankoegl/python-json-pointer ·
      » pip install jsonpointer
    
Published   Mar 23, 2026
Version   3.1.1
🌐
Readthedocs
python-json-pointer.readthedocs.io › en › latest › commandline.html
The jsonpointer commandline utility — python-json-pointer 3.0.0 documentation
usage: jsonpointer [-h] [--indent INDENT] [-v] POINTER FILE [FILE ...] Resolve a JSON pointer on JSON files positional arguments: POINTER File containing a JSON pointer expression FILE Files for which the pointer should be resolved optional arguments: -h, --help show this help message and exit --indent INDENT Indent output by n spaces -v, --version show program's version number and exit
Find elsewhere
🌐
GitHub
github.com › stefankoegl › python-json-pointer › blob › master › jsonpointer.py
python-json-pointer/jsonpointer.py at master · stefankoegl/python-json-pointer
Resolve JSON Pointers in Python. Contribute to stefankoegl/python-json-pointer development by creating an account on GitHub.
Author   stefankoegl
Top answer
1 of 11
89

There's no way you can do that changing only that line. You can do:

a = [1]
b = a
a[0] = 2
b[0]

That creates a list, assigns the reference to a, then b also, uses the a reference to set the first element to 2, then accesses using the b reference variable.

2 of 11
54

I want form.data['field'] and form.field.value to always have the same value

This is feasible, because it involves decorated names and indexing -- i.e., completely different constructs from the barenames a and b that you're asking about, and for with your request is utterly impossible. Why ask for something impossible and totally different from the (possible) thing you actually want?!

Maybe you don't realize how drastically different barenames and decorated names are. When you refer to a barename a, you're getting exactly the object a was last bound to in this scope (or an exception if it wasn't bound in this scope) -- this is such a deep and fundamental aspect of Python that it can't possibly be subverted. When you refer to a decorated name x.y, you're asking an object (the object x refers to) to please supply "the y attribute" -- and in response to that request, the object can perform totally arbitrary computations (and indexing is quite similar: it also allows arbitrary computations to be performed in response).

Now, your "actual desiderata" example is mysterious because in each case two levels of indexing or attribute-getting are involved, so the subtlety you crave could be introduced in many ways. What other attributes is form.field suppose to have, for example, besides value? Without that further .value computations, possibilities would include:

class Form(object):
   ...
   def __getattr__(self, name):
       return self.data[name]

and

class Form(object):
   ...
   @property
   def data(self):
       return self.__dict__

The presence of .value suggests picking the first form, plus a kind-of-useless wrapper:

class KouWrap(object):
   def __init__(self, value):
       self.value = value

class Form(object):
   ...
   def __getattr__(self, name):
       return KouWrap(self.data[name])

If assignments such form.field.value = 23 is also supposed to set the entry in form.data, then the wrapper must become more complex indeed, and not all that useless:

class MciWrap(object):
   def __init__(self, data, k):
       self._data = data
       self._k = k
   @property
   def value(self):
       return self._data[self._k]
   @value.setter
   def value(self, v)
       self._data[self._k] = v

class Form(object):
   ...
   def __getattr__(self, name):
       return MciWrap(self.data, name)

The latter example is roughly as close as it gets, in Python, to the sense of "a pointer" as you seem to want -- but it's crucial to understand that such subtleties can ever only work with indexing and/or decorated names, never with barenames as you originally asked!

🌐
Real Python
realpython.com › videos › pointers-python-overview
Pointers and Objects in Python (Overview) (Video) – Real Python
Hi, I’m Austin Cepalia with realpython.com! And in this course, you’ll learn all about pointers and memory management in Python. Love them or hate them, pointers are essential to writing efficient code in many low-level languages. If you’ve ever…
Published   July 7, 2020
🌐
Jg-rp
jg-rp.github.io › python-jsonpath › pointers
JSON Pointers - Python JSONPath
from jsonpath import JSONPointer example_data = {"foo": {"bar": [1, 2, 3]}} pointer = JSONPointer("/foo/bar/0") print(pointer.resolve_parent(example_data)) # ([1, 2, 3], 1) # 'thing' does not exist pointer = JSONPointer("/foo/thing") print(pointer.resolve_parent(example_data)) # ({'bar': [1, 2, 3]}, <jsonpath.pointer._Undefined object at 0x7f0c7cf77040>) pointer = JSONPointer("") print(pointer.resolve_parent(example_data)) # (None, {'foo': {'bar': [1, 2, 3]}})
🌐
Real Python
realpython.com › pointers-in-python
Pointers in Python: What's the Point? – Real Python
August 13, 2024 - In this step-by-step tutorial, you'll get a clearer understanding of Python's object model and learn why pointers don't really exist in Python. You'll also cover ways to simulate pointers in Python without the memory-management nightmare.
🌐
Snyk
snyk.io › advisor › python packages › jsonpointer
jsonpointer - Python Package Health Analysis | Snyk
Python Versions Compatibility · >=3.7 · Age · 14 years · Latest Release · 1 year ago · Dependencies · N/A · Versions · 27 · Maintainers · 1 · Wheels · OS Independent · Library to resolve JSON Pointers according to RFC 6901 · See source code for examples ·
🌐
Nickmccullum
nickmccullum.com › python-pointers
How to Use Python Pointers | Nick McCullum
In Python, this creates a new name and not a new object. You can validate this by using the below script. ... The output will be true. Note that new is still an immutable object. You can perform any operation on new and it will create a new object. Now that we have a fair understanding of what mutable objects are let us see how we can use this object behavior to simulate pointers in Python.