0

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

Nicholas Obert
  • 1,235
  • 1
  • 13
  • 29
Chinnu
  • 1
  • 2
  • 4
    if this is content of flowfile then EvaluateJsonPath could be a better solution because it looks like json – daggett Jul 31 '23 at 21:20

1 Answers1

0

@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.

steven-matison
  • 1,554
  • 1
  • 9
  • 12