title: dictionary to Codable in swift
body: <p>string value:</p>
  
  <pre><code>Optional("{\n  \"WebResponse\": {\n    \"HasError\": \"FALSE\",\n    \"ResponseMessage\": \"Signed in Successfully.\",\n    \"Result\": \"SUCCESS\",\n    \"ResultData\": {\n      \"C\": {\n        \"CustomerId\": \"656\",\n        \"CustomerName\": \"swift son\",\n        \"UserName\": \"swift@infinx.com\",\n        \"Type\": \"FORM\",\n        \"OldGCMID\": \"eA5RV0TSCoY:APA91bFea67cIlKlVes6Scdgth4CiHSzpk78hE89953-l6gK4O9xflYAs0p24jzccBtqQgAMoRaEM4SOdJ1546QDtYk2nm64cZurwz58c9Pmww4JLRDA7wtWSktpdFdVkX94VoiSCPdm\",\n        \"GCMID\": \"\",\n        \"LoyaltyPoint\": \"0\",\n        \"CorporateId\": \"19\",\n        \"U\": {\n          \"EmailVerified\": \"1\"\n        }\n      }\n    }\n  }\n}")
  </code></pre>
  
  <p>json response: </p>
  
  <pre><code>{
  WebResponse =     {
      HasError = FALSE;
      ResponseMessage = "Signed in Successfully.";
      Result = SUCCESS;
      ResultData =         {
          C =             {
              CorporateId = 19;
              CustomerId = 656;
              CustomerName = "swift son";
              GCMID = "";
              LoyaltyPoint = 0;
              OldGCMID = "eA5RV0TSCoY:APA91bFea67cIlKlVes6Scdgth4CiHSzpk78hE89953-l6gK4O9xflYAs0p24jzccBtqQgAMoRaEM4SOdJ1546QDtYk2nm64cZurwz58c9Pmww4JLRDA7wtWSktpdFdVkX94VoiSCPdm";
              Type = FORM;
              U =                 {
                  EmailVerified = 1;
              };
              UserName = "swift@infinx.com";
          };
      };
  };
  }
  </code></pre>
  
  <p>my models:</p>
  
  <pre><code>struct CData:Codable {
  var corporateId:String
  var customerId:String
  var customerName:String
  var gCMID:String
  var loyaltyPoint:String
  var oldGCMID:String
  var types:String
  var userName:String
  
  enum CodingKeys: String, CodingKey {
      case corporateId = "CorporateId"
      case customerId = "CustomerId"
      case customerName = "CustomerName"
      case gCMID = "GCMID"
      case loyaltyPoint = "LoyaltyPoint"
      case oldGCMID = "OldGCMID"
      case types = "Types"
      case userName = "UserName"
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>struct ResultData: Codable {
  var resultData: CData
  
  enum CodingKeys: String, CodingKey {
         case resultData = "ResultData"
     }
   }
  
  
  struct WebResponse: Codable {
      var HasError: Bool
      var ResponseMessage: String
      var Result: String
      var ResultData: ResultData
  
  
      enum CodingKeys: String, CodingKey {
          case HasError = "HasError"
          case ResponseMessage = "ResponseMessage"
          case Result = "Result"
          case ResultData = "ResultData"
      }
      }
  
  
  when I covert this response to data and put it in model using
  
      let jsonRes = try JSONDecoder().decode(WebResponse.self, from: dataFromString)
                                  print(jsonRes)
  </code></pre>
  
  <p>to give me error </p>
  
  <blockquote>
    <p>keyNotFound(CodingKeys(stringValue: "HasError", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"HasError\", intValue: nil) (\"HasError\").", underlyingError: nil))</p>
  </blockquote>