DefaultReads provides the readers you need to convert json values ββto regular types ( String , Option , Array , etc.). Therefore, providing new readers for String not required.
Therefore, to access a field in your json object, you do not need to define a reader if you do not want to read this field in an arbitrary type.
All you need in this case is the restriction that is defined in both Reads and Constraints . Therefore, assuming your json jsValue object, the following code gives you what you want:
// val jsValue = ... (jsValue \ "search").as[String](Reads.minLength(3))
source share