cancel
Showing results for 
Search instead for 
Did you mean: 

Key value pair from object array

deepak_shaw
Contributor

Hi,
I would like to create the below outbound message from an incoming object array.

{
    "root": {
        "elementName": {
            "@attributeName": "attributeValue",
            "$": "elementValue"
        },
        "repeatedElement": [
            {
                "key": {
                    "@attr": "attr1",
                    "$": "key1"
                },
                "value": "value1"
            },
            {
                "key": {
                    "@attr": "attr2",
                    "$": "key2"
                },
                "value": "value2"
            }
        ]
    }
}

Any suggestion please on the repeated elements, attributes, and values?
Thanks,
Deepak Shaw

1 ACCEPTED SOLUTION

Done, check the pipeline and let me know if this works for you. Can be made with multiple mappers or a JSON Schema as well, but this is simpler in terms of snaps usage.

Key value pair from object array_2022_05_20.slp (4.3 KB)

View solution in original post

11 REPLIES 11

bojanvelevski
Valued Contributor

Hey @deepak.shaw,

Are you able to share a sample of the incoming data?

Hi,
Yes, Attached the incoming message.

Looking forward for your suggestion/solution.
Regards,
Deepak.

Hi @bojanvelevski , the required file is attached.

The objects contain quite a lot information, so please share some info on which are the corresponding fields that you want in your output.