# JSONPath This document describes the JSONPath syntax used in the application for querying JSON data. ## Basic Syntax JSONPath expressions always start with `$`, which represents the root object. ### Path Navigation - `$` - Root object - `.property` - Child property access - `['property']` - Child property access (bracket notation) - `[index]` - Array index access - `[*]` - All elements in an array - `..property` - Recursive descent (all properties with this name) ### Operators and Filters - `[start:end:step]` - Array slice - `[?(@.property)]` - Filter expression (elements with the specified property) - `[?(@.property == value)]` - Filter with comparison - `[?(@.property > value)]` - Filter with comparison - `[?(@.property in [val1, val2])]` - Filter with value matching ## Examples ### Basic Property Access ``` $.store.book[0].title # First book's title $.store.book[*].title # All book titles $.store.book[*].price # All book prices ``` ### Array Access ``` $[0] # First element $[*] # All elements $[0,1,2] # First three elements $[0:2] # Range of elements (first two) ``` ### Filters ``` $.store.book[?(@.price < 10)] # Books cheaper than $10 $.store.book[?(@.category == 'fiction')] # Fiction books $.store.book[?(@.authors[*] == 'J. R. R. Tolkien')] # Books by Tolkien ``` ### Special Operators ``` $..book # All books anywhere in the document $..title # All titles anywhere in the document $root:$.property # Reference to root from a nested context ``` ## Project-Specific Usage In this application, JSONPath is used for: - Data source selectors - Data extraction from JSON responses - Dynamic field mapping - Data splitting and filtering Example selectors from the project: ``` $.val1 # Simple property access $.nested_1.nested_1_1 # Nested property access $['split1'] # Bracket notation $[*].table # All tables in an array $.additionalData2[?(@.name == 'N1')].values[*].val # Filtered nested access ``` Reference: - [JSONPath - XPath for JSON (https://goessner.net/articles/JsonPath/)](https://goessner.net/articles/JsonPath/) - [JSONPath Online Evaluator (https://jsonpath.com/)](https://jsonpath.com/)