Created
December 1, 2016 15:00
-
-
Save BasThomas/0f894d610f7f24732077fa961a6fc182 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let jsonString = "{\"message\": \"422 Unprocessable Entity\",\"errors\": {\"email\": [\"The email has already been taken.\"],\"mobile_number\" : [\"The mobile number has already been taken.\"]}}" | |
let jsonData = jsonString.data(using: .utf8) | |
do { | |
if let jsonData = jsonData { | |
let object = try JSONSerialization.jsonObject(with: jsonData, options: []) as? [AnyHashable: Any] | |
} | |
} catch { | |
print(error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This prints