Parsing JSON

In the previous chapter, we learned how to make a REST API request and receive a response. In this chapter, we’ll go over how to parse the response and extract the information we need. To represent the data, we will use the JSON format.

Projects

1. Pokemon

Create a Pokemon class that mimics the JSON response from the PokeAPI that you used in the previous chapter. Add a From Map method that takes a Map<String, dynamic> and returns a Pokemon object. Update the project from previous chapter to use the Pokemon class.

2. Movie

Create a Movie class that mimics the JSON response from the OMDB API that you used in the previous chapter. Add a From Map method that takes a Map<String, dynamic> and returns a Movie object. Update the project from previous chapter to use the Movie class.

Resources