Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/303#discussion_r64142229
  
    --- Diff: nifi-docs/src/main/asciidoc/expression-language-guide.adoc ---
    @@ -1161,7 +1161,61 @@ Expressions will provide the following results:
     
|=======================================================================================
     
     
    +[.function]
    +=== jsonPath
    +
    +*Description*: [.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*: [.subject]#String#
    +
    +*Arguments*:
    +    [.argName]#_jsonPath_# : [.argDesc]#the JSON path expression used to 
evaluate the Subject.#
     
    +*Return Type*: [.returnType]#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
    +}
    +..........
    +
    +.jsonPath Examples
    +|===================================================================
    +| Expression | Value
    +| `${myJson:jsonPath('$.firstName')}` | `John`
    +| `${myJson:jsonPath('$.address.postalCode')}` | `10021-3100`
    +| `${myJson:jsonPath('$.phoneNumbers[?(@.type=="home")].number')}`^1^ | 
`212 555-1234`
    +| `${myJson:jsonPath('$.phoneNumbers')}` | `[{"type":"home","number":"212 
555-1234"},{"type":"office","number":"646 555-4567"}]`
    +| `${myJson:jsonPath('$.missing-path')}` |
    +| `${myJson:jsonPath('$.bad@expression')}` |
    --- End diff --
    
    For the bad JSON Paths (missing or invalid), perhaps it should explicitly 
say the value is "_empty_" or something like that. I couldn't find other 
examples of table entries where the values were empty, but I did see one where 
a space was called out by _space_ to make it more explicit and visible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to