JSONPath Architecture: RFC 9535 Standards & API Query Filtering
Originally proposed by Stefan Gรถssner in 2007 and formalized as RFC 9535 by the Internet Engineering Task Force (IETF), JSONPath provides an XPath-like query syntax tailored for JSON documents. It enables API consumers, ETL data pipelines, and assertion libraries (such as Postman, RestAssured, and Kubernetes JSONPath templates) to isolate targeted data attributes without writing bespoke traversing algorithms.
1. JSONPath Expression Evaluation Mechanics
The evaluation engine processes path segments sequentially starting from the root symbol ($). When encountering a wildcard (*) or slice ([start:end]), the engine fans out into a multi-node collection. Filter expressions ([?(@.prop > val)]) apply predicate logic across collection items, returning only objects that satisfy the comparison.
Frequently Asked Questions (FAQ)
What is JSONPath and what is it used for?
JSONPath (standardized under IETF RFC 9535) is a declarative query language for extracting specific nodes and subsets from JSON documents, similar to what XPath does for XML.
What is the difference between single dot (.) and recursive descent (..) in JSONPath?
A single dot (.property) accesses direct child properties. Recursive descent (..property) searches recursively down all nested levels and arrays to find all matching keys anywhere in the JSON hierarchy.
How do JSONPath filter expressions work?
Filter expressions [?(@.price < 10)] evaluate a boolean condition on each item in an array, where @ refers to the current item. Only items where the expression returns true are included in the results.