{"id":9054,"library":"jsonpath-rfc9535","title":"JSONPath (RFC 9535)","description":"jsonpath-rfc9535 is a Python library that provides a comprehensive and compliant implementation of JSONPath, as defined by RFC 9535. It allows users to query and manipulate JSON data structures using standard JSONPath expressions. The library is currently at version 1.0.0 and maintains an active development cadence with regular updates.","status":"active","version":"1.0.0","language":"en","source_language":"en","source_url":"https://github.com/jg-rp/python-jsonpath-rfc9535","tags":["json","jsonpath","rfc9535","query","data-manipulation"],"install":[{"cmd":"pip install jsonpath-rfc9535","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The top-level import for the main class uses 'jsonpath' module name, not 'jsonpath_rfc9535'.","wrong":"from jsonpath_rfc9535 import JSONPath","symbol":"JSONPath","correct":"from jsonpath import JSONPath"}],"quickstart":{"code":"from jsonpath import JSONPath\n\ndata = {\n    \"store\": {\n        \"book\": [\n            { \"category\": \"fiction\", \"author\": \"Herman Melville\", \"title\": \"Moby Dick\", \"isbn\": \"0-553-21311-3\", \"price\": 8.99 },\n            { \"category\": \"fiction\", \"author\": \"J.R.R. Tolkien\", \"title\": \"The Lord of the Rings\", \"isbn\": \"0-395-19395-8\", \"price\": 22.99 }\n        ],\n        \"bicycle\": { \"color\": \"red\", \"price\": 19.95 }\n    }\n}\n\n# Find all book titles\npath = JSONPath(\"$.store.book[*].title\")\nfor node in path.findall(data):\n    print(node.value)\n\n# Find books cheaper than 10\npath_cheap_books = JSONPath(\"$.store.book[?(@.price < 10)]\")\nfor node in path_cheap_books.findall(data):\n    print(node.value)\n","lang":"python","description":"Demonstrates how to import JSONPath, define a JSONPath expression, and use it to find matching nodes in a JSON document."},"warnings":[{"fix":"If you relied on `JSONPathNode.value` being immutable or read-only, be aware of this change. For v1.0.0+, explicitly copy the `node.value` if you need to modify it without affecting the source, or use the setter knowingly to update the source.","message":"In version 1.0.0, the `JSONPathNode.value` attribute was changed to a property with a setter. Assigning a new value to `node.value` will now modify the original source JSON data structure. In previous versions, `value` was read-only.","severity":"breaking","affected_versions":"1.0.0+"},{"fix":"Always ensure you are using the latest stable version of `jsonpath-rfc9535` to benefit from parsing improvements and bug fixes, ensuring better RFC 9535 compliance and robustness.","message":"Early versions (pre-1.0.0) had several bug fixes related to parsing complex filter expressions, escape sequences, number literals, and bracketed segments. Using older versions with complex or malformed JSONPath queries could lead to `JSONPathSyntaxError` or incorrect results.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"When using `search()` or `match()`, always check for the `_LogicalFalse` return value if the pattern might be invalid. Ensure your regular expressions comply with I-Regexp as specified in RFC 9485.","message":"The `search()` and `match()` functions validate I-Regexp patterns according to RFC 9485. If an invalid pattern is provided, these functions will return `_LogicalFalse` instead of raising an exception. This behavior was introduced in v0.1.2.","severity":"gotcha","affected_versions":"0.1.2+"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement from `from jsonpath_rfc9535 import JSONPath` to `from jsonpath import JSONPath`.","cause":"The Python package name on PyPI is `jsonpath-rfc9535`, but the primary module imported by the library is `jsonpath`.","error":"ModuleNotFoundError: No module named 'jsonpath_rfc9535'"},{"fix":"Carefully review your JSONPath query against the RFC 9535 specification. Ensure all parentheses, brackets, and string literals are correctly balanced and escaped. Also, ensure you are on the latest library version as previous versions had parsing bugs.","cause":"The JSONPath query string provided contains a syntax error, such as mismatched brackets, invalid escape sequences, or incorrect filter expression formatting.","error":"jsonpath.exceptions.JSONPathSyntaxError: Unbalanced parentheses (or similar syntax errors in queries)"},{"fix":"For versions <1.0.0, `JSONPathNode.value` cannot be directly assigned. For v1.0.0+, be aware that `node.value = new_value` updates the original data. If you need a local, immutable copy, first store `node.value` in a new variable before modification.","cause":"In versions prior to 1.0.0, `JSONPathNode.value` was a read-only attribute, thus attempts to set it would fail. In version 1.0.0+, assigning to `JSONPathNode.value` now modifies the underlying source JSON data, which might be unexpected if you expected immutable behavior.","error":"AttributeError: can't set attribute 'value' (for versions <1.0.0) OR unexpected modification of source data (for versions 1.0.0+)"}]}