Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Perform cardinality-Many in JOLT

I want to write a Jolt definition using cardinality-Many that can transform object "PO_POD_LN_EVW1" into list and ignore if its already a list.

Input JSON :

{
    "PURCHASE_ORDER_DISPATCH": {
        "MsgData": {
            "Transaction": {
                "PSCAMA": {
                    "PUBLISH_RULE_ID": {
                        "IsChanged": "Y"
                    }
                },
                "PO_POD_HDR_EVW1": {
                    "STATE_BILL": "",
                    "CURRENCY_CD": {
                        "IsChanged": "Y",
                        "content": "USD"
                    },
                    "ADDRESS4_VNDR": "",
                    "PO_POD_LN_EVW1": {
                        "WG_ACCOUNT": 641100,
                        "LINE_NBR": {
                            "IsChanged": "Y",
                            "content": 1
                        },
                        "ITM_ID_VNDR": "B0798CX2Q9",
                        "PO_POD_SHP_EVW1": {
                            "LINE_NBR": {
                                "IsChanged": "Y",
                                "content": 1
                            }
                        }
                    },
                    "WG_ADDR_SEQ_NUM": 1
                }
            }
        }
    }
}

JOLT Spec :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{
    "operation": "cardinality",
    "spec": {
        "PURCHASE_ORDER_DISPATCH": {
            "MsgData": {
                "Transaction": {
                    "PO_POD_HDR_EVW1": "MANY"
                }
            }
        }
    }
}

Getting this error: Failed to Transform

>Solution :

Your jolt spec is correct, But You should wrap all of your specs in the [] array.

Try this:

[
  {
    "operation": "cardinality",
    "spec": {
      "PURCHASE_ORDER_DISPATCH": {
        "MsgData": {
          "Transaction": {
            "PO_POD_HDR_EVW1": "MANY"
          }
        }
      }
    }
  }
]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading