I
I
Ivan Kolesnik2016-11-09 03:07:46
JSON
Ivan Kolesnik, 2016-11-09 03:07:46

JSON to NSDictionary?

Good day to dear Tostovites. All evening I have been tormented by the question of how to convert an incoming string into an ordinary dictionary. Example, there is a line like

{"status":401,"answer":"user_not_exists","data":{"email":"\[email protected]"}}

It needs to be turned into a Swift-friendly NSDictionary
[
    "status" : 401,
    "answer" : "user_not_exists",
    "data" : [
         "email" : "[email protected]"
     ]
]

so that you can address, for example, like this: decodedJsonString["answer"]
Thank you in advance.
---------
UPD
Most of all the option hands, instead of libraries interests.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-11-09
@dart_kinselok

https://github.com/SwiftyJSON/SwiftyJSON

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question