Support Questions

Find answers, ask questions, and share your expertise

Extract string nested in JSON value

avatar
Contributor

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

 

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"
}

 

 

1 ACCEPTED SOLUTION

avatar
Explorer
2 REPLIES 2

avatar
Explorer

avatar
Contributor

Thanks @suraj143 

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