Support Questions

Find answers, ask questions, and share your expertise

SPLIT json and parse new filed in NIFI

avatar
Explorer

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

avatar
Super Collaborator

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

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