If you removed it from the routes file, you will end up having to distinguish between JSON and HTML anyway, somewhere.

You can either do the same thing in a different way and share code ending up in the same thing, or just repeat code.

Personally I prefer just using a `case _ => NotFound` with a `case books => if books.nonEmpty` and then doing an if inside the second block for JSON 
Making ADTs like what @adamnfish is saying is good too though, especially for matching! And the scala compiler will help you because you are using the types!

Also it's worth mentioning that you can use reverse routing from play even with these routes with a string in them.