I am getting this error as JSON result.error. While my JSON is an valid one, check it on JSON vaildator online.

This is my code for JSON request.

```
Alamofire.request(.POST, url, parameters: parameters, encoding:.JSON)
                .responseJSON { (request, response, result) in
                    hud.hide(true)
                    // Set flag to disale poor internet connection alert
                    weakInternet = false
                    print(result.error)
                    if (result.value != nil) {
                        print("API Response: \(result.value!)")
                        // Pass the response JSON to the completion block
                        completion(json: result.value!)
                    } else {
                        // Response JSON is NULL
                    }
            }

```

When i hit the same service with particular request parameters i am getting this response.

```
{"error":"success","post_data":{"first_name":"hd","last_name":"df","email":"hiiaaaaaaa@dnsa.coma","password":"himanshu","confirm_password":"himanshu","companies":["Big Rattle Technologies_Fg_yes"],"institutes":[""]},"msg":"success","data":{"_id":"5742ae1564b35e37369f0838","first_name":"hd","last_name":"df","email":"hiiaaaaaaa@dnsa.coma","profile_pic":"","loc":[0,0],"locs":{"type":"Point","coordinates":[0,0]},"institutes":[],"companies":[{"comapny_id":"555b2d0a678e79ed510041ce","group_id":"556c2434678e79a1820041dd","name":"Big Rattle Technologies","designation":"Fg","is_current":"yes"}],"device_token":"","user_group":"site_user","is_verified":0,"is_disclose":1,"is_discover":1,"wallNotification":1,"messageNotification":1,"matchNotification":1,"verificationSent":0,"status":1,"mobile":"","linkedin_id":"","facebook_id":"","os":"","qblox_id":12957726,"updated_at":"2016-05-23 07:15:33","created_at":"2016-05-23 07:15:33","current_company":"Big Rattle Technologies"}}

```

Anybody knows what is the problem in my case?
['https://Stackoverflow.com/questions/37384772', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6064629/']
There is an issue with my web service. They are giving me the response in "text/HTML" format rather than HTML. When i printed my response on debugger then i got:

```
"Content-Type" = "text/html; charset=UTF-8";

```

Now, i updated my webservice and everything is working like a charm.
I got this error when using the **wrong** Firebase Server key to send a remote push notification.

Go to `Firebase` > `Project Overview` > `CogIcon` > `Project Settings` > `Cloud Messaging` > `Server Key`

[![enter image description here](https://i.stack.imgur.com/CLK8F.png)](https://i.stack.imgur.com/CLK8F.png)

```
guard let url = URL(string: "https://fcm.googleapis.com/fcm/send") else { return }    

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.httpBody = try?

let paramDict = [String:Any]() // this has values
JSONSerialization.data(withJSONObject: paramDict, options: [])
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let serverKey = "firebase server key" // *** SERVER KEY USED HERE ***
request.setValue("key=\(serverKey)", forHTTPHeaderField: "Authorization")

let task = URLSession.shared.dataTask(with: request)  { (data, response, error) in

    do {
        if let jsonData = data {

            if let jsonDataDict = try JSONSerialization.jsonObject(with: jsonData, options: JSONSerialization.ReadingOptions.allowFragments) as? [String: AnyObject] {
                print("jsonData Successfully Sent data: \n\(jsonDataDict))")
            }
        }
    } catch let err as NSError {
        print("jsonData Error: \(err.debugDescription)")
    }
}
task.resume()

```