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.

Generate Separate UUID for JSON array of objects

Generate Separate UUID for JSON array of objects

Explorer

Hi All,

 

I am trying to generate separate UUID for JSON array of objects. I tried to use ${UUID()} in JOLT specification, but this is generating same UUID for all the elements.

 

e.g.

Input:

===============

{
  "aliases": [
    "Alias1",
    " Alias2"
   ]
}

 

JOLT Specification

=====================

[
{
"operation": "shift",
"spec": {
"aliases": {
"*": "alias[&0].name"
}
}
},
{
"operation": "modify-default-beta",
"spec": {
"alias": {
"*": {
"id": "${UUID()}"
}
}
}
}
]
Current Output:

=====================

"alias" : [ {
"name" : "Alias1",
"id" : "2948446b-6213-44ba-b81f-c4e5f7dab2eb"
}, {
"name" : " Alias2",
"id" : "2948446b-6213-44ba-b81f-c4e5f7dab2eb"
} ]

 

Any pointers will be greatly appreciated.

 

Thanks,

Biswa 

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