My current json format is like this:
{
{
'id' : 61,
'item' : 'apple pie,banana split',
'quantity' : '2,1',
'price' : '100000,50000'
},
{
'id' : 62,
'item' : 'beef steak,salad',
'quantity' : '1,2',
'price' : '50000,100000'
}
}
what i want is like this:
{
{
'id' : 61,
'item' :
{
'1': {'name': 'apple pie', 'quantity' : '2','price': '100000'},
'2': {'name': 'banana split', 'quantity' : '1','price': '50000'}
}
},
{
'id' : 62,
'item' :
{
'1': {'name': 'beef steak', 'quantity' : '1','price': '50000'},
'2': {'name': 'salad', 'quantity' : '2','price': '100000'}
}
}
}
My database is like this:
split_id item quantity price
61 apple pie~|~banana split 2~|~1 100000~|~50000
62 beef steak~|~salad 1~|~2 50000~|~100000
I use "~|~" because if I use "," then it will recognize as the next column value in query. And I'm not create a new row to avoid multiple value of item, quantity,and price because it represents different transaction.
I found answer for this question but it is in php and mysql. I can't find the javascript and oracle one. I appreciate any kind of help for this question. Thank you.
[]for an array (and not{}for an object).