bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.54k stars 328 forks source link

Transform Flat JSON to an array #1175

Open marcoconnor-virtustream opened 1 year ago

marcoconnor-virtustream commented 1 year ago

Hi all, need help with what's probably a basic transform, but can't find an example.

Here's my input and desired output:

INPUT

{ "1": "Value1", "2": "Value2", "3": "Value3" }

Desired Output

{ "to": "table_name", "data" [ { "1": { "value": "Value1" }, "2": { "value": "Value2" }, "3": { "value": "Value3" } } ] }

Thanks!

DhruvSingh861 commented 1 year ago

I think this will help :)

[
  {
    "operation": "shift",
    "spec": {
      "#table_name": "to",
      "*": {
        "@": "data[#3].&0.value"
      }
    }
  }
]