Is there any way to get pure JSON response with AFNetworking Obj-C?

Viewed 704

I already have an architecture setup with AFNetworking in my iOS app that is written in Obj-C. It returns the response as a Dictionary but I would like to play around with a pure JSON response to try Codable in Swift 4. Is that possible? Or what would be my options here?

1 Answers

One possible solution recreate a JSON :

var dataJson = try! JSONSerialization.data(withJSONObject: responseObject, options: JSONSerialization.WritingOptions.prettyPrinted)
var objCodable = try! JSONDecoder().decode(ObjCodable.self, from: dataJson)
Related