After learning how to create APIs, we need to pass data back and forth. While the path provides one method to do that, anything a little more sophisticated (for example, a long list of things) will quickly show the limitations of these methods. This is why other formats are typically used to structure the data—JSON (http://json.org/) is the most popular for web services. In this chapter, we are going to use the previous API and enhance it by handling and returning JSON.
Handling JSON payloads
Getting ready
Let's set up a Rust binary project using cargo new json-handling. Since we are going to serve stuff on the local port 8081, make sure that the port is accessible as well. Additionally, a program such as curl...