Please Help -> Problem with json and tableview

Hey

I have a json file with data that I plan to have on a server or dropbox but for now I just have it locally on the computer when testing on simulator.

When I open the file, I can't get it to add the entries to the tableview row, they return empty everytime. The json is valid, what am I doing wrong?

json file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
    "data": [
        
        {
            "weekDays": [
                {
                    
                    "day":{
                        "name":"Monday",
                        
                    "data": [
                        {
                            "name": "Dancing",
                            "price": "$13.95",
                            "description": "Latin dance for all ages."
                        },
                        {
                            "name": "Bodypump",
                            "price": "Free",
                            "description": "Get toned for the summer!"
                        }
                    ]
                    }
                },
                {
                    "day":{
                        "name":"Tuesday",
                        
                    "data": [
                        {
                            "name": "Dancing",
                            "price": "$13.95",
                            "description": "Latin dance for all ages."
                        },
                        {
                            "name": "Bodypump",
                            "price": "Free",
                            "description": "Get toned for the summer!"
                        }
                    ]
                    }
                },
                {
                    "day":{
                        "name":"Wednesday",
                        
                    "data": [
                        {
                            "name": "Dancing",
                            "price": "$13.95",
                            "description": "Latin dance for all ages."
                        },
                        {
                            "name": "Bodypump",
                            "price": "Free",
                            "description": "Get toned for the summer!"
                        }
                    ]
                    }
                }
            ]
        }
    ]
}

I still can't figure out where it goes wrong, I've tried so many ways now and none of them works.
If this;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 for i = 1, #myFile.data do
myFile.data[i].weekDays.day.name
myFile.data[i].weekDays.day.data.name
 
 for i = 1, #myFile do
myFile.data.weekDays.day.name
myFile.data.weekDays.day.data.name
 
 for i = 1, #myFile do
myFile[i].data.weekDays.day.name
myFile[i].data.weekDays.day.data.name
 
 for i = 1, #myFile.data.weekDays do
myFile.data.weekDays[i].day.name
myFile.data.weekDays[i].day.data.name

I compared my json file to the facebook json response in another thread and changed my file accordingly to make it work but it still doesn't populate the tableview rows.

Can someone PLEASE help me with this, the json is validated....

activities.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
    "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": "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": "Bodypump",
                            "price": "Free",
                            "time":"12.20",
                            "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!"
                        }
                ]
            }
        }
    ]
}
views:1961 update:2012/2/12 11:34:30
corona forums © 2003-2011