This tutorial covers Circe, a functional JSON handling library for Scala, part of the Typelevel ecosystem and well integrated with Cats.
The video covers:
A note about the placement of Json codecs and the "automatic derivation considered harmful" part of the video: placing our
Encoder[YoutubeVideo] in the companion object of YoutubeVideo would have solved the problem. Since Scala automatically imports implicits from companion objects, we would have never forgotten the import in the first place.
However, some scenarios require Json codecs to be placed elsewhere: it could be that your architecture is very opinionated, for example, some architecture patterns encourage you to clearly separate business concerns from implementation details, in which case your codecs will likely be away from your core business types; or it could be that a single type has several encoders and decoders, because your application needs to address multiple clients and multiple transports.
I know many projects won't be affected by the downsides of automatic derivation; but more complex project will. This is why I choose to avoid it altogether in favor of semi-auto derivation or custom-built codecs depending on the use case.