1

Hello everyone my json input is this:

{
  "chequesCollateral": [
    {
      "accountNum": "0026.0002.62.0300162968",
      "agreement": "0026.5501.90.0490520505",
      "checkno": "229425941           ",
      "amount": 20000,
      "issueBank": "0026",
      "branch": "0154",
      "currency": "EUR",
      "expDate": "2019-09-20"
    },
    {
      "accountNum": "0026.0002.62.0300162968",
      "agreement": "0026.5501.90.0490520505",
      "checkno": "322108888           ",
      "amount": 2500,
      "issueBank": "0011",
      "branch": "0335",
      "currency": "EUR",
      "expDate": "2019-10-26"
    },
    {
      "accountNum": "0026.0002.62.0300162968",
      "agreement": "0026.5501.90.0490520505",
      "checkno": "321979826           ",
      "amount": 3964.77,
      "issueBank": "0011",
      "branch": "0104",
      "currency": "EUR",
      "expDate": "2019-10-31"
    }
  ]
}

I use this transform to produce this:

[
  {
    "operation": "shift",
    "spec": {
      "chequesCollateral": {
        "*": {
          "issueBank": "distinctBinData.&0"
        }
      }
    }
  }
]

and this is produced:

{
  "distinctBinData" : {
    "issueBank" : [ "0026", "0011", "0011" ]
  }
}

I want to produce this :

{
  "distinctBinData" : [ "0026", "0011", "0011" ]
}

What should i do?

1 Answer 1

1

You don't have to specify the &0 part in the destination key. &0 refers to the current level JSON key, which is issueBank in your case. So when you specified the destination key as distinctBinData.&0, it resolves to distinctBinData.issueBank. So just use distinctBinData as the destination key as follows.

[
{
    "operation": "shift",
    "spec": {
        "chequesCollateral": {
            "*": {
                "issueBank": "distinctBinData"
            }
        }
    }
}
]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.