Ste5an pointed that the order is probably meaning less, especially if the json is read by another program somewhere///
Bharat Guru
ASKER
In json some time the order is as below and I want to generate the table using javascript where total comes before detail.
{
"records":[
{
"Location":"UK",
"RecordType":"Fruits",
"Productid":124,
"Qty":11,
"Name":"Bananna"
},
{
"Location":"UK",
"RecordType":"Fruits",
"Productid":124,
"Qty":11,
"Name":"Bananna"
},
{
"Location":"UK",
"RecordType":"Fruits",
"Productid":230
"Qty":25
"Name":"Peach
},
{
"Location":"UK",
"RecordType":"Grocery",
"Productid":224,
"Qty":11,
"Name":"Basmati Rice"
},
{
"Location":"UK",
"RecordType":"Fruits",
"Qty":16,
"Name":"Total"
},
{
"Location":"UK",
"RecordType":"Grocery",
"Qty":11,
"Name":"Total"
}
]
}
Your table is going to be displayed by some program.
As far as I understand, you currently read each object and display it asap.
You might consider silghtly alterating you program so that it keeps all objetcs / lines until they are all read, and then display them in the order you want.
You did not mention which program is generating the output. Is it a javascript program to whch you have access?
But you're aware that order is absolutly meaningless in this context?