Reputation: 363
I'm getting response from socket as below:
(
{
response = {
demo = (
{
"code" = 612064;
"code1" = "T";
"code2" = "http://www.XXXXXXX.com";
}
);
response = "get_nearby";
};
status = success;
}
)
How to convert to dictionary?
Upvotes: 0
Views: 300
Reputation: 72460
The response you are showing is not Dictionary
it is Array of Dictionary
, So try to convert your response to [[String:AnyObject]]
.
if let array = yourResponse as? [[String:AnyObject]], let firstDic = array.first {
print(firstDic)
print(firstDic["status"])
}
Upvotes: 2