Hi am new to objective C, Thanks in advance for any help.

```
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{

    NSLog(@"Notification Received: %@", userInfo);
    NSString *NSSMessage = [NSString stringWithFormat:@"%@", userInfo];

    NotificationMessageHandler *obj = [[NotificationMessageHandler alloc] init];
    [obj handleNotificationMessage: NSSMessage]; // NSSmessage is a string to convert into JSON

}

```

I had following as NSString in NSSMessage 

```
{
    aps =     {
        alert = "\"Status\":\"Confirm\",\"Location\":\"\",\"Type\":\"Telephone Consultation\",\"Date\":\"2015-01-05\",\"Time\":\"19:03\",\"RescheduleDate\":\"\"";
        badge = 1;
        sound = "beep.wav";
    };
}

```

Inside handleNotificationMessage, am converting NSString to JSON format

```
- (void) handleNotificationMessage : (NSString *) NSSParam
{

    if(NSSParam != nil && NSSParam != Nil)
    {

        // Parse the string
        NSLog(@"NSS Message Param %@", NSSParam);

        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@" "
                                                            withString:@""];
        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"\n"
                                                               withString:@""];

        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"aps="
                                                       withString:@"\"aps\":"];
        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"alert=\""
                                                       withString:@"\"alert\":{"];
        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"\"\";"
                                                       withString:@"\"},"];

        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"badge="
                                                       withString:@"\"badge\":"];
        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"sound="
                                                       withString:@"\"sound\":"];

        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@"}}\""
                                                       withString:@"}}"];

        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@";"
                                                                           withString:@","];
        NSSParam = [NSSParam stringByReplacingOccurrencesOfString:@",},}"
                                                       withString:@"}}"];

        NSLog(@"NSS Message Param After Parsing %@", NSSParam);

             NSData *data = [NSSParam dataUsingEncoding:NSUTF8StringEncoding];
        id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; // Here json is null
}
}

```

After parsing i had a JSON as following

```
{"aps":{"alert":{\"Status\":\"Confirm\",\"Location\":\"\",\"Type\":\"TelephoneConsultation\",\"Date\":\"2015-01-05\",\"Time\":\"20:15\",\"RescheduleDate\":\"\"},"badge":1,"sound":"beep.wav"}}

```

I had used following code to convert from NSString to JSON

```
NSData *data = [NSSParam dataUsingEncoding:NSUTF8StringEncoding];
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; // Here json is null

```

Here json object shows null but NSData has object.
So, How to convert NSString to NSDictionary in objective c?
Please help !