0

Need Jolt spec for converting a nested JSON to a denormalized JSON.

Input:

{
   header :
     company: "ABC",
     ip: 10.3.2.4,
     network : [ {url:"http://abc.in", "latency":2000}, {url:"http://xzy.au", "latency":2000}],
}

Output:

[
{
  url:"http://abc.in",
   ip: 10.3.2.4
},
{
  url:"http://xzy.com",
   ip: 10.3.2.4
}
]
HDJEMAI
  • 9,436
  • 46
  • 67
  • 93

1 Answers1

0

Spec

[
  {
    "operation": "shift",
    "spec": {
      "header": {
        "network": {
          "*": {
            "url": {
              "@": "[&2].url",
              "@(3,ip)": "[&2].ip"
            }
          }
        }
      }
    }
  }
]
Milo S
  • 4,466
  • 1
  • 19
  • 22