title: if let can not assign value to a Variable
body: <p>I am developing an app than can extract data from fitbitapi and show it in a tableview, however when I try to append the data I got from web API to the original model, here is my code</p>
  
  <pre><code>for json in jsons.values {
          print("json is \(json)")
          if let Json = json as? [String : Any]{
  
              var healthData : StepStats? = nil
              if let date = Json["dateTime"] as? String,
                  let value = Json["value"] as? Int{
                  healthData = StepStats(dateTime : date, value : value as AnyObject)
  
              }
              if let HealthData = healthData {
                  model.append(HealthData)
              }
  
          }
          else {
              print("Unexpected Error")
  
          }
  </code></pre>
  
  <p>Every time I run this code, it gives unexpected Error, and Json = nil the initial json is here</p>
  
  <pre><code>    {
      dateTime = "2018-04-15";
      value = 0;
  },
      {
      dateTime = "2018-04-16";
      value = 6969;
  },
  }
  </code></pre>
  
  <p>I think it is the formate of the Json data I received not well formatted, or is there anything wrong with my code? Please help me I am new to swift so it may be basic mistake, but any help will be appreciate.</p>
  
  <p>The unparsed Data is like this </p>
  
  <pre><code>Optional("{\"activities-steps\":[{\"dateTime\":\"2018-04-17\",\"value\":\"7170\"},{\"dateTime\":\"2018-04-18\",\"value\":\"6443\"},{\"dateTime\":\"2018-04-19\",\"value\":\"11254\"},{\"dateTime\":\"2018-04-20\",\"value\":\"5771\"},{\"dateTime\":\"2018-04-21\",\"value\":\"33\"},{\"dateTime\":\"2018-04-22\",\"value\":\"2697\"},{\"dateTime\":\"2018-04-23\",\"value\":\"11\"},{\"dateTime\":\"2018-04-24\",\"value\":\"8\"},{\"dateTime\":\"2018-04-25\",\"value\":\"0\"},{\"dateTime\":\"2018-04-26\",\"value\":\"0\"},{\"dateTime\":\"2018-04-27\",\"value\":\"0\"},{\"dateTime\":\"2018-04-28\",\"value\":\"389\"},{\"dateTime\":\"2018-04-29\",\"value\":\"4916\"},{\"dateTime\":\"2018-04-30\",\"value\":\"0\"},{\"dateTime\":\"2018-05-01\",\"value\":\"0\"},{\"dateTime\":\"2018-05-02\",\"value\":\"0\"},{\"dateTime\":\"2018-05-03\",\"value\":\"0\"},{\"dateTime\":\"2018-05-04\",\"value\":\"1929\"},{\"dateTime\":\"2018-05-05\",\"value\":\"0\"},{\"dateTime\":\"2018-05-06\",\"value\":\"0\"},{\"dateTime\":\"2018-05-07\",\"value\":\"0\"},{\"dateTime\":\"2018-05-08\",\"value\":\"2818\"},{\"dateTime\":\"2018-05-09\",\"value\":\"6990\"},{\"dateTime\":\"2018-05-10\",\"value\":\"6558\"},{\"dateTime\":\"2018-05-11\",\"value\":\"15434\"},{\"dateTime\":\"2018-05-12\",\"value\":\"0\"},{\"dateTime\":\"2018-05-13\",\"value\":\"0\"},{\"dateTime\":\"2018-05-14\",\"value\":\"0\"},{\"dateTime\":\"2018-05-15\",\"value\":\"0\"},{\"dateTime\":\"2018-05-16\",\"value\":\"0\"},{\"dateTime\":\"2018-05-17\",\"value\":\"0\"}]}")
  </code></pre>