            do {
                let decoder = JSONDecoder()
                let decodedObject: T = try decoder.decode(T.self, from: data)
                completion(decodedObject, nil)
            } catch {
                completion(nil, .decoding)