Resolve a JSON Pointer without evaluating expressions
Python
Read one JSON value through a restricted RFC 6901 string pointer.
Read one JSON value through a restricted RFC 6901 string pointer. This stdin-based Python CLI processes one bounded JSON request and returns the documented JSON result. It does not execute jobs or contact external services. Inspect its limits before adapting it to an application.
Before you start
Python 3.12 standard library; no third-party packages. Verified with the recorded pinned runtime.
One UTF-8 JSON object on stdin, no command-line arguments. Maximum encoded request size is 20000 bytes.
Build and check
Save the source as resolve-json-pointer-python.py.
Save the example JSON below as request.json.
Run python3 resolve-json-pointer-python.py < request.json.
Compare the parsed JSON result with the expected output. Invalid input exits 2 with empty stdout and a generic stderr message.
Limits to understand
Input is limited to 20000 bytes, and the decoded pointer is limited to 1024 Unicode characters.
Non-integer JSON numbers use Python binary floating-point representation; values that become non-finite are rejected, and finite values may be rounded.
URI fragment pointers, URL decoding, array append tokens, mutation, and expression evaluation are not supported.
Input exactly {"document":any JSON value,"pointer":string}. Pointer is empty for root, otherwise begins slash. Decode each token ~1 to slash and ~0 to tilde in one pass; reject any other tilde escape.
Object tokens are exact keys. Array tokens must be 0 or a nonzero ASCII digit followed by ASCII digits; reject leading zeros, negative values, dash and out-of-range indices. Maximum pointer length 1024.
Output {"value":selected_value}; reject missing keys or traversing a scalar. No URI fragment form, URL decoding, mutation or dynamic evaluation.
The complete encoded input is limited to 20000 bytes; one additional byte can be read to detect overflow.
This is a bounded local helper. Passing the recorded cases does not verify every input, every Python version or an external integration.
Code license: MIT. Keep the license notice with your copy.
Example version 1.0.0 · Documentation reviewed 2026-11-16.
22 recorded CLI cases passed in rootless Docker on the pinned Python 3.12 runtime, with 512 MiB RAM, 1 CPU, no network, and read-only source. Other runtimes and all possible inputs are not verified.