Skip to main content
vatodorov19
Silver ⭐️⭐️⭐️
October 29, 2020
Solved

Extract string nested in JSON value

UPDATE: If you ever need to modify a record use this solution: https://community.cloudera.com/t5/Support-Questions/NiFi-UpdateRecord-processor-is-not-updating-JSON-path/m-p/186256

 

ORIGINAL question:

How can I extract a string nested in the value of a JSON? For the status key below, I only want the value Active, instead of MapRecord[{current_status=Active}].

 

Original JSON

 

{
"indicator": "147.183.200.154",
"timestamp": 1577742090000,
"status": "MapRecord[{current_status=Active}]"
}

 

 

Desired final JSON

 

{
"indicator": "147.183.200.154",
"timestamp": 1577742090000,
"status": "Active"
}

 

 

suraj143
suraj143Answer
Gold ⭐️
October 31, 2020

2 replies

suraj143
suraj143Answer
Gold ⭐️
October 31, 2020
vatodorov19
Silver ⭐️⭐️⭐️
November 2, 2020

Thanks @suraj143 

I ended up using an UpdateRecord, but your approach with a JoltTransformJSON also works.

Translate