The following format orders data is in payload.
{
"orders" : {
"order" : [ {
"id" : "4358294728",
"fulfillment" : {
"tracking_number" : "917",
"line-items" : {
"id" : "8367649608"
}
}
}, {
"id" : "4358301768",
"fulfillment" : {
"tracking_number" : "918",
"line-items" : [ {
"id" : "8367663240"
}, {
"id" : "8367663304"
}, {
"id" : "8367663368"
} ]
}
} ]
}
}
i want to get the total number. orders from this payload. I am using #[message.payload.orders.order.size()] for this. It is giving right output.
But for a single order it is giving wrong the output = 2. But it will be 1.
{
"orders" : {
"order" : {
"id" : "4358153416",
"fulfillment" : {
"tracking_number" : "915",
"line-items" : {
"id" : "8367362760"
}
}
}
}
}
Can you please help me to get the desired output?