Apache NiFi Expression Language GuidePDF version

jsonPathDelete

Description: The jsonPathDelete function deletes the specified JsonPath from a Subject JSON and returns string form of the updated JSON.

Subject Type: String

Arguments: jsonPath : the JSON path expression to delete from 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
}

Expression

Value

${myJson:jsonPathDelete('$.firstName')}

{"lastName":"Smith","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"}]}

${myJson:jsonPathDelete('$.missing-path')}

Returns original JSON document

An empty subject value or a subject value with an invalid JSON document results in an exception bulletin.