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.

JOLT Spec for supporting the input json

JOLT Spec for supporting the input json

New Contributor

Actually I need to filter the id exist data and non existing data to separate user defined array list. can someone help me with Jolt Specification. someone please help me with the jolt specification to achieve the below results.

 

Input:
          
{
    "data": [
        {
            "name": "a",
            "id": "100"
        },
        {
            "name": "b",
            "id": "101"
        },
        {
            "name": "c"
        }
    ]
}
            
Output:
            
 

  
        {
    "IdExists": [
        {
            "name": "a",
            "id": "100"
        },
        {
            "name": "b"
        }
    ],
    "IdNotExists": [
        {
            "name": "c"
        }
    ]
}
        
1 REPLY 1
Highlighted

Re: JOLT Spec for supporting the input json

Explorer

jolt specification :

[{
"operation": "shift",
"spec": {
"@": "&",
"data": {
"*": {
"id": {
"@(1)": "idexist.[]"
}}}}}]

output : 

{
"root" : {
"data" : [ {
"name" : "a",
"id" : "100"
}, {
"name" : "b",
"id" : "101"
}, {
"name" : "c"
} ]
},
"idexist" : [ {
"name" : "a",
"id" : "100"
}, {
"name" : "b",
"id" : "101"
} ]
}

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