Try the following chain spec:

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "$": "type",
        "*": {
          "*": "&"
        }
      }
    }
  }
]

This will "flatten" any key with an array value into a "type" field
with the name of the array key, and all its entries as top-level
fields.

Regards,
Matt


On Wed, Jan 15, 2020 at 2:52 PM l vic <lvic4...@gmail.com> wrote:
>
> i have input json such as the following example:
> {
>  "Address": [
> {
>  "Street": "Washington St",
>  "ZIP": "03420",
>  "unit": "1"
> }
> ]
> }
> How can i use Jolt transform to add array name as attribute value to
> array members as following result:
> {
> "type": "Address",
> "Street": "Washington St",
>  "ZIP": "03420",
>  "unit": "1"
> }
> Thank you,

Reply via email to