I am trying to convert serialized Json
string to NSDictionary
but not find any solution to convert serialized Json
to NSDictionary
.
This is my response string
{"id":2,"parent_id":1,"lft":2,"rght":3,"name":"Audio Engineering","images":[{"id":22,"user_id":2,"name":"iStock_000027023404_Small","url":"https:\/\/pbs.twimg.com\/profile_images\/97601593\/Picture_3_400x400.png","alt":"iStock_000027023404_Small","description":"","thumbnail":"a:3:{i:0;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:30;s:6:\"height\";i:30;s:3:\"url\";s:58:\"\/uploads\/2016\/09\/thumb\/small\/iStock_000027023404_Small.jpg\";}i:1;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:90;s:6:\"height\";i:90;s:3:\"url\";s:59:\"\/uploads\/2016\/09\/thumb\/medium\/iStock_000027023404_Small.jpg\";}i:2;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:230;s:6:\"height\";i:230;s:3:\"url\";s:67:\"\/uploads\/2016\/09\/thumb\/medium_251x230\/iStock_000027023404_Small.jpg\";}}","created":"2016-09-07T06:24:09+00:00","modified":"2016-09-07T06:24:09+00:00","_joinData":{"id":12,"category_id":2,"image_id":22}}]}
Which I am trying to convert to NSDictionary
. In this value for key Thumbnail
is serialized data which I am not able to parse.
I have tried
NSData *data = [[self getJsonnResponse] dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
error:&error];
if (error)
NSLog(@"%@",[error description]);
else
NSLog(@"%@",json);
It throws me error
Error Domain=NSCocoaErrorDomain Code=3840 "Badly formed object around character 291." UserInfo={NSDebugDescription=Badly formed object around character 291.}