As seen in the previous recipes, Akka HTTP has great integration for marshaling and unmarshaling. This is especially true if we want to serialize and deserialize JSON entities. Akka HTTP was initially developed under a different project named Spray. Spray had similar modules as Akka HTTP does. However, Spray had a JSON serialization library called spray-json. This module was not ported to Akka HTTP and stayed spray-json. This was because the Akka team did not want to own a serialization library, but provide means to integrate any marshaling library into Akka HTTP.
In this recipe, we will see how to easily integrate spray-json into our application to serialize and deserialize classes into and from JSON.