SwiftyJSON object back to string SwiftyJSON object back to string ios ios

SwiftyJSON object back to string


From the README of SwiftyJSON on GitHub:

//convert the JSON to a raw Stringif let string = libraryObject.rawString() {//Do something you want  print(string)}


//convert the JSON to a raw Stringif 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'    }}