creating JSON format in Objective C

后端 未结 6 445
感动是毒
感动是毒 2020-12-10 07:19

For an application i want to create a JSON in format as mentioned below,

\"Students\" : {
    \"results\": {
        \"Grade1\": {
            \"studentresul         


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 07:59

    In order to get the format you want out of it, you have to pack information in that particular format.

    Your problem is right about here:

    NSMutableArray *rarray = [[NSMutableArray alloc] init];
    [rarray addObject:grade];
    [rarray addObject:sdetails];
    

    The desired format has no arrays, so why are you creating an array?

    A hint for you:

    You should be creating exactly 4 dictionaries, and no arrays.

提交回复
热议问题