Skip to content
Advertisement

Adding default values to array in Jolt

I am trying to transform a json using jolt, it’s just adding some default values to an array.

the input looks like this:

JavaScript

The output should be:

JavaScript

My spec looks right now:

JavaScript

I just can’t pass the valC to the listWithItems and haven’t found anything in the documentation. Can someone help me with this?

Thank you in advance!

Advertisement

Answer

One option would be changing the order of the transformations such as

JavaScript

enter image description here

Another option uses modify transformation such as

JavaScript

enter image description here

You can check out https://github.com/bazaarvoice/jolt/releases/ as a source and https://jolt-demo.appspot.com/ as a playground.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement