โ07-04-2023 11:31 PM
Need to convert the below source JSON to target JSON
Source :
โHeaderโ:
{
โCustomfieldโ:
{
โABPERโ:โ202303โ,
โABKRSโ:โSLโ
}
}
Target :
โHeaderโ:
{
โCustomfieldโ:
{
โfieldnameโ :โABPERโ,
โfieldvalueโ : โ202303โ
},
{
โfieldnameโ :โABKRSโ,
โfieldvalueโ : โSLโ
}
}
@dmiller @rsramkoski can you please in converting the json to the above given format.
โ07-05-2023 12:30 AM
Hello @mohit3,
You can try with the following expression in a Mapper Snap:
sl.range(0,$Header.Customfield.entries().length).map( (x,ind) => {"fieldname":$Header.Customfield.entries()[ind][0], "fieldvalue":$Header.Customfield.entries()[ind][1]})
Here is a sample pipeline:
โsl-comm-json-transform_2023_07_05.slp (3.7 KB)
Let me know if this helps you.
Regards,
Aleksandar.