jsonPath
Description: The jsonPath
function
generates a string by evaluating the Subject as JSON and applying a JSON path expression. An
empty string is generated if the Subject does not contain valid JSON, the
jsonPath is invalid, or the path does not exist in the Subject. If
the evaluation results in a scalar value, the string representation of scalar value is
generated. Otherwise a string representation of the JSON result is generated. A JSON array
of length 1 is special cased when [0]
is a scalar, the string
representation of [0]
is generated.1
Subject Type: String
Arguments: jsonPath : the JSON path expression used to evaluate the Subject.
Return Type: String
Examples: If the "myJson" attribute is
{ "firstName": "John", "lastName": "Smith", "isAlive": true, "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100" }, "phoneNumbers": [ { "type": "home", "number": "212 555-1234" }, { "type": "office", "number": "646 555-4567" } ], "children": [], "spouse": null }
Table 1.15. Table 15. jsonPath Examples
Expression |
Value |
|
|
|
|
|
|
|
|
|
empty |
|
exception bulletin |
An empty subject value or a subject value with an invalid JSON document results in an exception bulletin.