views:

23

answers:

2

I have a great framework however I cannot figure out how to create requests. All the tutorials assume you are simply downloading and parsing Json data - but I need to build a Json request send it off and then parse the response.

Anyone have ideas and in particular sample code which builds up the request.

+1  A: 

In this JSON framework...you can use the JSONRepresentation method on NSDictionary and NSArray.....

SPatil
Thanks mate I will try that out!
TheLearner
That doesn't seem to work: -JSONRepresentation failed. Error trace is: ( Error Domain=org.brautaset.JSON.ErrorDomain Code=4 UserInfo=0x680abe0 "Not valid type for JSON"
TheLearner
A: 

The framework doesn't handle NSObject but NSDictionary seems to work:

NSDictionary *jsonDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"value1", @"key1", @"value2", @"key2", nil];

NSString *requestJson = [jsonDictionary JSONRepresentation];
NSLog(@"requestJson %@", requestJson);
TheLearner