I have a custom service that accepts this contract class as an input
{
"_input":
{
"header":
{
"dataArea": "A1",
"mainId": "1",
"line":
[
{
"fieldA": 1,
"id": "Id1"
},
{
"fieldA": 2,
"id": "Id2"
},
{
"fieldA": 3,
"id": "Id1"
}
]
}
}
}
After accepting this contract as an input to the custom service, how can i add x++ code to convert it to the format below? ( i want to group the ids in lines)
{
"_input":
{
"header":
{
"dataArea": "A1",
"mainId": "1",
"ids":
[
{
"id": "id1",
"Line":
[
{
"fieldA": 1
},
{
"fieldA": 3
}
]
},
{
"id": "id2",
"line":
[
{
"fieldA": 2
}
]
}
]
}
}
}