Friday, 28 August 2015

NSMutableArray convert to jsonString

   NSString *jsonString;
   NSError *error;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:nsmutablearray
                                                       options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string
                                                         error:&error];
    if (!jsonData) {
        NSLog(@"Got an error: %@", error);
    } else {
        jsonString  = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
        

    }


No comments:

Post a Comment