I need convert json string from this array
( {
1 = 4;
},
{
8 = 20;
})
Actually i need output like {"custom":{"1":"3","8":"21"}} but i got "{\n \"custom\" : \"[\\n {\\n \\\"1\\\" : \\\"4\\\"\\n },\\n {\\n \\\"8\\\" : \\\"20\\\"\\n }\\n]\"\n}"
here is my code
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:mydict options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
is there any way to get output like this : {"custom":{"1":"3","8":"21"}}