How can I extract value by using Extract Text Processor?

50 Views Asked by At

I need to extract a property by using an extract text processor

I have a Replace Text processor that has the property

"Input_String": 
    {"columnId":"19","value":"Helloworld","name":"Test"},
"Message_Type":"ADT_A01"

I am trying to extract 'Input_String' by using ExtractText processor with the following regular expression:

"Input_String"\s*:\s*\{[^}]*\} 

but it returns:

"Input_String":{"columnId":"19","value":"Helloworld","name":"Test"},

However, I only need it to return its value

{"columnId":"19","value":"Helloworld","name":"Test"}

How can I get only the value of the property

1

There are 1 best solutions below

0
On

@Chinnu

EvaluateJsonPath is what you need here. In this processor click + and add property columnID with value $.columnId. Repeat for other values.

If your input string is not the json object {...} and includes any string characters before or after the {}, then use ExtractText to get the entire object as the flowfile. Then use EvaluateJsonPath as above.