SwiftyJSON object back to string
From the README of SwiftyJSON on GitHub:
//convert the JSON to a raw String
if let string = libraryObject.rawString() {
//Do something you want
print(string)
}
//convert the JSON to a raw String
if let strJson = jsonObject.rawString() {
// 'strJson' contains string version of 'jsonObject'
}
//convert the String back to JSON (used this way when used with Alamofire to prevent errors like Task .<1> HTTP load failed (error code: -1009 [1:50])
if let data = strJson.data(using: .utf8) {
if let jsonObject = try? JSON(data: data) {
// 'jsonObject' contains Json version of 'strJson'
}
}