title: Swift 3 - Add key value to dictionary in parsed JSON Response
body: <p>I am calling URL to get a JSON response, an array of dictionaries. I want to append a key:value pair in each dictionary that I get in my response. How do I go about this in swift 3?</p>
  
  <p>For instance, my JSON Response is:</p>
  
  <pre><code>[{"id":"100", "name":"Matt", "phone":"0404040404"}
  ,{"id":"100", "name":"Sean", "phone":"0404040404"}
  , {"id":"100", "name":"Luke", "phone":"0404040404"}]
  </code></pre>
  
  <p>I want to modify the response to show another key "address", so the output becomes:</p>
  
  <pre><code>[{"id":"100", "name":"Matt", "phone":"0404040404", "address":"TBC"}
  ,{"id":"100", "name":"Sean", "phone":"0404040404", "address":"TBC"}
  , {"id":"100", "name":"Luke", "phone":"0404040404", "address":"TBC"}]
  </code></pre>
  
  <p>My code for just parsing the response is below, doesn't have the code to append the key:value pair. <strong><em>Can I append while parsing itself?</em></strong></p>
  
  <pre><code>let Task = URLSession.shared.dataTask(with: URL!) { (Data, response, error) in
              if error != nil {
                  print(error)
              } else {
                  if let DataContent = Data {
                      do {
                          let JSONresponse = try JSONSerialization.jsonObject(with: DataContent, options: JSONSerialization.ReadingOptions.mutableContainers)
                          print(JSONresponse)
  
                          for item in JSONresponse as! [Dictionary&lt;String, Any&gt;] {
                              let id = item["id"] as! String
                              let name = item["name"] as! String
                              let phone = item["phone"] as! String         
                          }
                      }
                      catch { }
                  }
              }
          }
          Task.resume()
  </code></pre>