From the course: iOS App Development: RESTful Web Services

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

REST response handling of JSON

REST response handling of JSON - iOS Tutorial

From the course: iOS App Development: RESTful Web Services

Start my 1-month free trial

REST response handling of JSON

- [Instructor] So we've looked at creating our task, querying the server and receiving data back. We've also seen that by converting that data to a string, we can tell that it's JSON text. We can use that text to access the various data members and create our instance of a music object to populate all of it's properties. We can also use the JSONSerialization class to get an object based on that data. We've seen in our debug console that in a case of accessing multiple objects from the server we get back an array. Or for one object, we get back a dictionary. So the JSONSerialization parsing also can return back an array or a dictionary depending on the data being passed down. From that data that we parse, we can then create our object and set all the properties. So back in our project, we're now going to use the JSONSerialization object to parse the JSON we received back. So once we have the data, we're going to parse it and add this on line 21 to do so. We're going to say, if let…

Contents