Best way to write json(structure)

I have a json file with a few entries, I’m going to add more but the problem I encounter is when I add the data to my tableview with this:

One question first, what is best; have one onRowRender inside the for loop or have it outside?

Outside for loop:

local onRowRender(event)  
 local row = event.target  
 local rowGroup = event.view  
end  
for i = 1, #myTable.data do  
  
end  

or keep the onRowRender inside the loop?

for i = 1, #myTable.data do  
local onRowRender(event)  
 local row = event.target  
 local rowGroup = event.view  
end  

I get the number of tables within “data”:[]

What I really want to do is have weekDays as Category and in between them I want the number of “activities” for each day of the week.

if I would have a set number of rows in my tableview then if there are no activities in that day I would end up with empty cells.

How do I write my json so that the rows are the sum of #weekDays and #activitiy.data? Is it how I write the json that is wrong?

{ "data": [ { "weekDays": { "name": "Monday" }, "activity": { "data": [ { "name": "Dancing", "price": "$13.95", "time":"12.20", "description": "Latin dance for all ages." }, { "name": "Bodypump", "price": "Free", "time":"12.20", "description": "Get toned for the summer!" } ] } }, { "weekDays": { "name": "Tuesday" }, "activity": { "data": [ { "name": "Dancing", "price": "$13.95", "time":"12.20", "description": "Latin dance for all ages." }, { "name": "Bodypump", "price": "Free", "time":"12.20", "description": "Get toned for the summer!" } ] } }, { "weekDays": { "name": "Wednesday" }, "activity": { "data": [ { "name": "Dancing", "price": "$13.95", "time":"12.20", "description": "Latin dance for all ages." }, { "name": "Aerobics", "price": "$13.95", "time":"11.30", "description": "Latin dance for all ages." }, { "name": "Bodypump", "price": "Free", "time":"12.20", "description": "Get toned for the summer!" } ] } }, { "weekDays": { "name": "Thursday" }, "activity": { "data": [ { "name": "Dancing", "price": "$13.95", "time":"12.20", "description": "Latin dance for all ages." }, { "name": "Strip", "price": "$13.95", "time":"10.20", "description": "Latin dance for all ages." }, { "name": "Bodypump", "price": "Free", "time":"10.45", "description": "Get toned for the summer!" } ] } }, { "weekDays": { "name": "Friday" }, "activity": { "data": [ { "name": "Dancing", "price": "$13.95", "time":"12.20", "description": "Latin dance for all ages." }, { "name": "Bodypump", "price": "Free", "time":"12.20", "description": "Get toned for the summer!" } ] } } ] } [import]uid: 65840 topic_id: 22279 reply_id: 322279[/import]

This blog post may be of interest; http://blog.anscamobile.com/2011/08/tutorial-exploring-json-usage-in-corona/ [import]uid: 52491 topic_id: 22279 reply_id: 88801[/import]