(SWIFT) JSON Parse
2019. 4. 25. 16:47ㆍiOS
반응형
func parseJSONString(jsonString : String) -> [String:AnyObject]? {
guard let data = jsonString.data(using: .utf8) else {
return nil
}
do {
if let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: AnyObject] {
print(json);
return json
}
} catch {
print("Fail to parse JSON")
}
return nil
}
반응형
'iOS' 카테고리의 다른 글
Protocol (0) | 2019.12.30 |
---|---|
(SWIFT) Http (0) | 2019.04.25 |
(SWIFT) Toast (0) | 2019.04.25 |
(SWIFT) 화면 전환 (0) | 2019.04.25 |
concerning launch image (0) | 2019.04.24 |