title: Error when decoding JSON - keyNotFound(CodingKeys
body: <p>I am trying to parse JSON data over the network. Below you can see where the magic is happening. </p>
  
  <pre><code>func getBookingsForDate(date: String, completionHandler: @escaping ([String:String]) -&gt; Void ){
  
  struct bookings: Codable {
  
      var bookieName : String
      var bookieNumber: String
      var booked: String
      var bookingTime: String
  
      private enum Codingkeys: String, CodingKey{
  
          case bookieName
          case bookieNumber
          case booked
          case bookingTime
      }
  }
  
  let params = ["date":date]
  
  let urlString = "http://mscissorss.pythonanywhere.com/getBookings/"
  Alamofire.request(urlString, method: .get, parameters: params).responseJSON {
      response in
      switch response.result {
      case .success(let JSON):
  
          let decoder = JSONDecoder()
          guard let _ = response.data else{
              return
          }
          do {
              let loginDetails = try decoder.decode(bookings.self, from: response.data!)
              print(loginDetails)
          } catch let err{
              print(err)
          }
  
          //let bookings = JSON as! NSDictionary
          //completionHandler(JSON)
          /*
          do {
              let decoder = JSONDecoder()
              let gitData = try decoder.decode(bookings.self, from: JSON)
              print(gitData.bookieName)
  
          } catch let err {
              print("Err", err)
          }
          */
          break
      case .failure(let error):
          print(error)
      }
  }
  }
  </code></pre>
  
  <p>Given the code i am getting the following error message: </p>
  
  <pre><code>keyNotFound(CodingKeys(stringValue: "bookieName", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"bookieName\", intValue: nil) (\"bookieName\").", underlyingError: nil))
  </code></pre>
  
  <p>And the JSON response that i am getting looks like this: </p>
  
  <pre><code>{
      0 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "10:00";
      };
      1 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "10:30";
      };
      10 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "15:00";
      };
      11 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "15:30";
      };
      12 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "16:00";
      };
      13 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "16:30";
      };
      14 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "17:00";
      };
      15 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "17:30";
      };
      16 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "18:00";
      };
      2 =     {
          booked = false;
          bookieName = "";
          bookieNumber = "";
          bookingTime = "11:00";
      };
  }
  </code></pre>
  
  <p>It is the first time i am decoding so if you have an answer please try to explain a bit to why i need to make the change that i need. </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After changing the code to what @sh_khan and @vadian suggested it worked to parse it however i am still getting this error inside my parsed object:</p>
  
  <pre><code>["1": MagicS.(unknown context at 0x106932738).bookings(bookieName: "", bookieNumber: "", booked: "false", bookingTime: "10:30"), 
  "0": MagicS.(unknown context at 0x106932738).bookings(bookieName: "", bookieNumber: "", booked: "false", bookingTime: "10:00"),
  </code></pre>
  
  <p>Also, if i want to be able to access a single value lets say the first item with the key <code>"0" -&gt; bookieName</code>, how would i do that using <code>loginDetails</code></p>