Support Questions

Find answers, ask questions, and share your expertise

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

avatar
New Contributor

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
New Contributor

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