JSON object must always be treated as an array
Hello everyone.
i need help. I have a JSON file which contains in an object either an array of other objects or a single object. This is the relevant object "Product": [ or "Product": { .
How can I configure with the JOLT Transform processor to always expect an array in the object? The product object must always be treated as an array, even if it contains only a single object.
{
"costc": 9638,
"sum_amount": 543,
"sum_invitation": 0,
"sum_selfconsumption": 0,
"sum_loss": 0,
"sum_gross": "2764,000",
"sum_net": "2392,480",
"sum_margin": "2003,780",
"sum_costs_total": "388,700",
"sum_costs": "388,700",
"sum_costs_invitation": 0,
"sum_costs_selfconsumption": 0,
"sum_costs_loss": 0,
"sum_costs_total_percent": "16,25",
"sum_costs_percent": "16,25",
"Classes": {
"ClassSummary": [
{
"class": 1102,
"sum_amount": 117,
"sum_invitation": 0,
"sum_selfconsumption": 0,
"sum_loss": 0,
"sum_gross": "740,500",
"sum_net": "692,060",
"sum_margin": "552,385",
"sum_costs_total": "139,675",
"sum_costs": "139,675",
"sum_costs_invitation": 0,
"sum_costs_selfconsumption": 0,
"sum_costs_loss": 0,
"sum_costs_total_percent": "20,18",
"sum_costs_percent": "20,18",
"ProductDetails": {
"Product": [
{
"id": 7992160,
"artnr": 32212,
"sum_amount": 16,
"sum_invitation": 0,
"sum_selfconsumption": 0,
"sum_loss": 0,
"sum_gross": "80,000",
"sum_net": "74,770",
"sum_margin": "53,243",
"sum_costs_total": "21,527",
"sum_costs": "21,527",
"sum_costs_invitation": 0,
"sum_costs_selfconsumption": 0,
"sum_costs_loss": 0,
"sum_costs_total_percent": "28,79",
"sum_costs_percent": "28,79",
"value": null
},
{
"id": 7794909,
"artnr": 32205,
"sum_amount": 7,
"sum_invitation": 0,
"sum_selfconsumption": 0,
"sum_loss": 0,
"sum_gross": "56,000",
"sum_net": "52,340",
"sum_margin": "39,473",
"sum_costs_total": "12,867",
"sum_costs": "12,867",
"sum_costs_invitation": 0,
"sum_costs_selfconsumption": 0,
"sum_costs_loss": 0,
"sum_costs_total_percent": "24,58",
"sum_costs_percent": "24,58",
"value": null
},
{
"class": 19174,
"sum_amount": 17,
"sum_invitation": 0,
"sum_selfconsumption": 0,
"sum_loss": 0,
"sum_gross": "85,000",
"sum_net": "71,430",
"sum_margin": "71,430",
"sum_costs_total": 0,
"sum_costs": 0,
"sum_costs_invitation": 0,
"sum_costs_selfconsumption": 0,
"sum_costs_loss": 0,
"sum_costs_total_percent": 0,
"sum_costs_percent": 0,
"ProductDetails": {
"Product": {
"id": 7925180,
"artnr": 6201,
"sum_amount": 17,
"sum_invitation": 0,
"sum_selfconsumption": 0,
"sum_loss": 0,
"sum_gross": "85,000",
"sum_net": "71,430",
"sum_margin": "71,430",
"sum_costs_total": 0,
"sum_costs": 0,
"sum_costs_invitation": 0,
"sum_costs_selfconsumption": 0,
"sum_costs_loss": 0,
"sum_costs_total_percent": 0,
"sum_costs_percent": 0,
"value": null
}
}
}
]
}
}
]
},
"date": "2022-10-06"
}

