title: Swift 4 Playground - getting object/result from JSON
body: <p>I am using Swift 4 in Playgrounds (MacOS), testing my code as a beginner... I would like to get the object / result of title from a remote JSON. </p>
  
  <p>The code is working until the point 'print(object.title)' which I was hoping it would return the value of the first title in the imported JSON.</p>
  
  <pre><code>
  
      import Foundation
      import PlaygroundSupport
  
      PlaygroundPage.current.needsIndefiniteExecution = true
  
      // Create structer of Post
      struct Post: Codable {
          var userId: Int
          var title: String
          var body: String
      }
  
      // Remote JSON to Structed Object
      let url = URL(string: "https://jsonplaceholder.typicode.com/posts")!
      let jsonData = try! Data(contentsOf: url)
      let datastring = String(data: jsonData, encoding: .utf8)
      let decoder = JSONDecoder()
  
      do {
          // Decode data to object
          let object = try decoder.decode(Post.self, from: jsonData)
          print(object.title) 
      }
      catch {
          // Error Catch
          //print(error)
      }
  
  </code>
  </pre>