ios - objective-c json serialization -


i need create post request , in it's body need put json. template json file follows:

{"key" : [{...}, {...}, {...} ..... ]} 

what i've tried doing this:

@{@"key" : @[@{...}, @{...} ... ]}; 

the issue have puts round brackets around nsarray. output:

{key = ({...}, {...}, ..... )} 

snippet code(after i've created nsdictionary)

    nserror *error;     nsdata *jsondata = [nsjsonserialization datawithjsonobject:mydictionary                                                        options:nsjsonwritingprettyprinted                                                          error:&error];     [request sethttpbody:jsondata]; 

is there way me make nsarray have [ ] instead of ( )?

nslog uses {} printing nsdictionary , () printing nsarray contents. has nothing json. json data structure created , encoded correctly. verify this:

nslog(@"%@", [[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding]); 

and see actual json printed.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -