Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Extract string nested in JSON value

Solved Go to solution

Extract string nested in JSON value

Explorer

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

Accepted Solutions
Highlighted

Re: Extract string nested in JSON value

Explorer
2 REPLIES 2
Highlighted

Re: Extract string nested in JSON value

Explorer
Highlighted

Re: Extract string nested in JSON value

Explorer

Thanks @suraj143 

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

Don't have an account?
Coming from Hortonworks? Activate your account here