title: How to display parsed JSON data in UI?
body: <p>I have parsed data from a JSON object that I received from an API call. As of now, I can print the JSON data in the debugger console, however I am trying to convert the parsed JSON back into data that can be displayed in the UI. I have two models, and an example of a JSON object looks as such: </p>
  
  <pre><code>{ 
    "query": "milk",
    "sort": "relevance",
    "responseGroup": "base",
    "totalResults": 693,
    "start": 1,
    "numItems": 10,
    "items": [{
      "itemId": 10291863,
      "parentItemId": 10291863,
      "name": "Carnation Vitamin D Added Evaporated Milk, 12 oz",
      "msrp": 1.79,
      "salePrice": 1.48
    }]
  }
  </code></pre>
  
  <p>I only want to display information that details the <code>name</code> and <code>salePrice</code> keys. However since the JSON is nested I don't know how to reach to that layer in order to retrieve the values. Here is my data model code:</p>
  
  <pre><code>struct Item: Codable {
    let query: String
    let sort: String
    let responseGroup: String
    let totalResults: Int
    let start: Int
    let numItems = 25
    let items: [Product]
  }
  
  struct Product: Codable {
    let name: String
    let salePrice: Double
  }
  </code></pre>
  
  <p>Code to my ViewController: </p>
  
  <pre><code>class ViewController: UIViewController {
    @IBOutlet weak var itemField: UITextField!  
    @IBAction func filterButton(_ sender: Any) {
      var components = URLComponents()
      components.scheme = "http"
      components.host = "api.walmartlabs.com"
      components.path = "/v1/search"
      let queryItemKey = URLQueryItem(name: "apiKey", value: secretKey)
      var queryItemQuery = URLQueryItem(name: "query", value: itemField.text)
      components.queryItems = [queryItemKey, queryItemQuery]
      let searchURL = components.url       
      //Task to make API Network Call
      guard let url = components.url else { return }
      URLSession.shared.dataTask(with: url) { (data, response, error) in
        if error != nil {
          print(error!.localizedDescription)
        }  
        guard let data = data else { return }
        //Implement JSON decoding and parsing
        do {
          //Decode retrived data with JSONDecoder and assing type of Item object
          let productData = try JSONDecoder().decode(Item.self, from: data)
              print(productData) 
        } catch let jsonError {
          print(jsonError)
        }          
      }.resume()
    }
  
    override func viewDidLoad() {
      super.viewDidLoad()
    }
  }
  </code></pre>
  
  <p>The print log shows the following when I run my code (again, I only want to show the <code>name</code> and <code>salePrice</code> values. Is there a way I can place these values in an array or convert these values in a way I can populate my UI with? Thanks in advance.</p>