I have a webservice (.NET) which returns JSON result. The iOS application consumes that web service and gets a response. Everything works but when I get the response it is inside the object d. Here is the response:
{"d":"{\"Name\":\"azamsharp\"}"}
Now, as you can imagine I need to access the value of the property “Name” which is “azamsharp”. I followed another post which suggested the following approach:
NSLog(@"%@",[responseDict valueForKeyPath:@"d.Name"]);
But this gave me the following error:
reason: '[<NSCFString 0x4cd6270> valueForUndefinedKey:]: this class is not key value coding-compliant for the key Name.'
Any help on this issue is much appreciated!
There is no property “name” in that JSON object. Your JSON object has a single key, “d”, whose value is a string, which happens to be the string representation of another JSON object.
You would have to do something like this: