Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Help with JOLT Spec to add new json key with a value from another key

avatar
Visitor

Hoping someone can help me with a JOLT spec.

 

I have the following json:

{
"schemaVersion": "3.2",
"uniqueIdentifier": "ri.nzRNR5a3ad1AzOkv_2FU9WN6Z_2FluxpEl4eXjgUnYpgkvk_3D",
"entityType": "CAR"
}
 
and I need to use JOLT to transform to this:
 
{
"_id": "ri.nzRNR5a3ad1AzOkv_2FU9WN6Z_2FluxpEl4eXjgUnYpgkvk_3D",
"schemaVersion": "3.2",
"uniqueIdentifier": "ri.nzRNR5a3ad1AzOkv_2FU9WN6Z_2FluxpEl4eXjgUnYpgkvk_3D",
"entityType": "CAR"
}
 
I cannot figure out the correct spec.
 
Thanks!
1 ACCEPTED SOLUTION

avatar
Super Guru

Hi,

You can do this in different ways , here is one of them:

[
  {
    "operation": "shift",
    "spec": {
      "@uniqueIdentifier": "_id",
      "*": "&"
    }
  }
]

Hope that helps.

 

View solution in original post

2 REPLIES 2

avatar
Super Guru

Hi,

You can do this in different ways , here is one of them:

[
  {
    "operation": "shift",
    "spec": {
      "@uniqueIdentifier": "_id",
      "*": "&"
    }
  }
]

Hope that helps.

 

avatar
Visitor

Thank you so much - that worked perfectly.  I have so much to learn about JOLT.