Skip to main content
Ashi
Silver ⭐️⭐️
September 23, 2024
Question

SPLIT json and parse new filed in NIFI

"result" : "SUCCESS",
"correlationID" : "X8058296",
"generationTimestamp" : "1354",
"meHostName" : "rc01;rik2jc",
"nccVersion" : "SPS__R1",

 
This is my input in my nifi and i want to do changes in meHostName means i want mehostName to have 1st value like in this case rc01 and after that creating 1 more field with name devicename having second value means rik2jc
 
I acheived the 1st part means i configured in UpdateRecord processor 
Ashi_0-1727079245645.png

for meHostName and it is printing 1st value means it is running fine ,now please help me in acheiving devicename to have 2nd value of meHostName which is rik2jc . i have tried split(/meHostName, ';')[1] but its not working

 
 
 
 
 

1 reply

joseomjr
Gold ⭐️⭐️
November 3, 2024

You can achieve the same with a JOLT shift and this spec:

{
"*": "&",
"meHostName": {
"*;*": {
"$(0,1)": "case",
"$(0,2)": "devicename"
}
}
}
Translate