How to serialize more than 22 fields with nested object in spray?

176 Views Asked by At

I can extend RootJsonFormat in order to support more than 22 fields on the case class. However, my case class also contains nested objects and Option[Int] and Option[String]. How can I serialize those? The nested objects do not have more than 22 fields. I found a similar question on SO but unfortunately, I cannot get it working. Not sure what was meant by Tuple22 in the response.

1

There are 1 best solutions below

0
Rand Chen On

as this answer said, you can Providing JsonFormats for other Types, that means you can make you case class serialized by override implement you own write/read method.

here is a sample of how to approach it.