FHIRPath: Unexpected Token
The FHIRPath parser reached a token it cannot place in a valid expression. The expression is syntactically malformed at that point.
FHIRPath · Error
The error
Unexpected tokenWhy it happens
A dangling operator, a stray symbol, a missing operand, or mixing FHIRPath with another query syntax (XPath, JSONPath). For example name. with nothing after the dot.
How to fix it
Complete the expression so every operator has its operands and every path step has an identifier. Remove stray characters. Build the path one step at a time to find the offending token.
Example
The snippet below triggers the error:
Patient.name.The corrected version:
Patient.name.givenFrequently asked questions
Is FHIRPath the same as XPath or JSONPath?
No. FHIRPath has its own grammar. Borrowing XPath axes (//) or JSONPath syntax ($.) produces unexpected-token errors. Use dotted path navigation and FHIRPath functions instead.