Automatic Derivation

It is also possible to derive Encoders and Decoders for many types with no boilerplate at all. Circe uses shapeless to automatically derive the necessary type class instances:

import, io.circe.syntax._

case class Person(name: String)
case class Greeting(salutation: String, person: Person, exclamationMarks: Int)

Greeting("Hey", Person("Chris"), 3).asJson
// res0: io.circe.Json = JObject(
//   object[salutation -> "Hey",person -> {
//   "name" : "Chris"
// },exclamationMarks -> 3]
// )