May 2019
Intermediate to advanced
546 pages
12h 41m
English
Now, execute the same command for a person record. We use the Person resource and search for travolta. With this response, you need to create the same type of model for the Person object. Look out: maybe you can reuse the preceding object. You can find the solution to this exercise in the appendix of this book.
Now, we will convert our JSON response into the object records:
private static List<MovieResponse> constructMovies(String sResponse){ List<MovieResponse> lstMovies = new List<MovieResponse>(); if (sResponse != null){ JSONParser theParser = JSON.createParser(sResponse); while (theParser.nextToken() != null){ if (theParser.getCurrentToken() == JSONToken.FIELD_NAME && theParser.getText() == 'results'){ theParser.nextToken(); ...Read now
Unlock full access