I am passing some parameter to api , to done add to cart function. But when i pass the parameter , it showing the crash Invalid top-level type in JSON write\' i
Invalid top-level type in JSON write\'
There is a subtle difference
Try using this
JSONSerialization.jsonObject(with: data, options: []) as? [String:AnyObject]
instead of
JSONSerialization.data(withJSONObject: data, options: []) as? [String:AnyObject]