Support Questions

Find answers, ask questions, and share your expertise

Issue with NIFI extracting Attribute from flow file

avatar
Contributor

I need to get the sys_id into an attribute and have tried the following:

 

1. SplitJSON and EvaluateJSONPath but SplitJSON ends gets an EDT error based on the contents of the JSON.

 

1.1 SplitJSON

Tra_1-1650905352587.png

 

1.2 EvaluateJSONPath

Tra_2-1650905397773.png

 

 

2. Now I'm trying to cleanse the content in hopes I can just throw the one thing I need over to EvaluateJSONPath.  Currently having problems getting regex expression to function on flowfile to select all but one line and replace it with null.  

 

Regex expression tried:  ^(?!.*sys_id).*$

Tra_0-1650905299921.png

 

 

 

Flowfile content (sanitized and shortened)

{

  "result" : {

    "start_date" : "",

    "sla_due" : "UNKNOWN",

    "escalation" : "Normal",

    "sys_id" : "3614ce021b030d10c3598512f54bcb2d",

    "upon_approval" : "Proceed to Next Task",

    "correlation_id" : "",

    "made_sla" : "true",

    "backout_plan" : "",

    "conflict_status" : "Not Run",

    "sys_created_on" : "2022-04-25 09:36:27",

    "on_hold_task" : "",

    "display_value" : "global"

  }

}

1 REPLY 1

avatar

@Tra


The recommend path forward here is to use a JSON Record Reader and JSON Record Writer with schema matching your source (reader) and downstream needs.  You want to avoid splitjson and regex matching flow file contents.