11-26-2021 05:56 AM
Below are the input and the output of the data i require:
INPUT
[
{
"group": [
{
"Response": {
"IT_DATA": [
{
"LID": "LOA-1",
"LVOL": 2150000.0,
"LGM": 0.15,
"LRCW": 0.0077,
"LPRO": -0.028,
"LRCWOW": 0.0081,
"LLCUR": "EUR"
}
],
"ET_LOG": [
{
"MSGNUMBER": 1,
"MSGTY": "S",
"MSGV1": "LoA ID successfully updated.",
"MSGV2": "ABCDEFG",
"MSGV3": "",
"MSGV4": "",
"TIME_STMP": 123123
}
]
}
},
{
"Response": {
"IT_DATA": [
{
"LID": "LOA-2",
"LVOL": 740000.0,
"LGM": 0.286,
"LRCW": 0.01,
"LPRO": 0.121,
"LRCWOW": 0.03,
"LLCUR": "EUR"
}
],
"ET_LOG": [
{
"MSGNUMBER": 1,
"MSGTY": "S",
"MSGV1": "LoA ID successfully updated.",
"MSGV2": "ZYXM",
"MSGV3": "",
"MSGV4": "",
"TIME_STMP": 098098
}
]
}
}
]
}
]
OUTPUT
[
{
"LID": "LOA-1",
"LVOL": 2150000.0,
"LGM": 0.15,
"LRCW": 0.0077,
"LPRO": -0.028,
"LRCWOW": 0.0081,
"LLCUR": "EUR",
"MSGNUMBER": 1,
"MSGTY": "S",
"MSGV1": "LoA ID successfully updated.",
"MSGV2": "ABCDEFG",
"MSGV3": "",
"MSGV4": "",
"TIME_STMP": 123123
},
{
"LID": "LOA-2",
"LVOL": 740000.0,
"LGM": 0.286,
"LRCW": 0.01,
"LPRO": 0.121,
"LRCWOW": 0.03,
"LLCUR": "EUR",
"MSGNUMBER": 1,
"MSGTY": "S",
"MSGV1": "LoA ID successfully updated.",
"MSGV2": "ZYXM",
"MSGV3": "",
"MSGV4": "",
"TIME_STMP": 098098
}
]
This output will be later used to be put in a HTML table format and to sent via email.
Can anyone please help me out here. Thanks in advance.
11-26-2021 06:56 AM
Hey @aditya.gupta41,
Use the following expression in a mapper, and you’ll receive the output you need:
$group.map(x=>x.Response.values().reduce((acc,curr)=> acc.concat(curr),[]).reduce((acc,curr)=> acc.extend(curr), {}))
Regards,
Bojan
03-02-2022 04:20 AM
This worked for me. Thanks