check the data format in Swift coming from Rest API

April 12, 2020

If you want to check the data fromat coming out from the REST API, you can use the following code

 let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: [Any]]
                    
         let typeString = String(describing: type(of: json))
         print(json)