java - Process json with different data type in Circe -
in case, there might different data type of same json field. example:
"need_exp":1500 or
"need_exp":"-" how process case? know can processed parse or use custom encoders, complex json text, there way solve without rewriting whole decoder (for example, "tell" decoder convert int string in need_exp field)?
it called disjunction can encoded scala standard either class. map json following class:
case class foo(need_exp: either[string, int])
Comments
Post a Comment