i am trying to parse JSON data from web service into my Swift
JSON Output on my web browser:
 [{"code":0,"message":"Check Username and Password....","userid":""}]
Swift Code:
  Alamofire.request(URL_USER_LOGIN, method: .post, parameters: parameters).responseJSON
    {
    response in
    //printing response
    print(response)
    if let userJSON = response.result.value
    {
        let userdata:Dictionary = userJSON as! Dictionary<String, Any>
        let message:Dictionary = userdata["message"] as! Dictionary<String, Any>
        print(message)
    }
I want to use message element from the JSON for my code. However i get the following output and error:
    (
    {
    code = 1;
    message = "Login Successfull";
    userid = 236;
}
)
     Could not cast value of type '__NSSingleObjectArrayI' (0x10fd94b98) to 'NSDictionary' (0x10fd958b8).
   2018-11-03 20:15:10.762929+0530 testDisplayTable[44610:2871941]
   Could not cast value of type '__NSSingleObjectArrayI' (0x10fd94b98) to 'NSDictionary' (0x10fd958b8).
How do I successfully get the value of message and print? Can someone please show me the correct code for my case. Thanks in advance!
 
    