hit counter

Timeline

My development logbook

Incorrect Way to Use JSONKit?

At the beginning I use the following code to decode a JSON string:

1
2
3
4
5
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    JSONDecoder* decoder = [[JSONDecoder alloc]
                            initWithParseOptions:JKParseOptionNone];
    NSArray* json = [decoder objectWithData:receivedData];

and then I tried to convert the json data with this function:

1
2
3
4
5
6
-(voide) convertJSONData:(id)json {
    NSEnumerator *enumerator = [json objectEnumerator];
    id anObject;

    while (anObject = [enumerator nextObject]) {
        // test for anObject class and handle accordingly

It is probably not an efficient way to handle the incoming json data.