I have a case class that is having more than 22 parameters and to serialize this case class I am using json-play-extension.
Pseudo code is as follows
case class Foo(a1: Int,a2: Int,a3: Int,...,a24: Int)
I have an implicit for Foo as follows
implicit val jsonFormat : OFormat[Foo] = Jsonx.formatCaseClass[Foo]
Till now, my only requirement was to simply serialize and deserialize this case class. However, now I have an additional requirement to exclude certain fields during serialization. For example, in my output I want to exclude fields a1 and a2 from the json output.
My desired output is as follows
{
“a3” : 3,
“a4” : 4,
.
.
“a24” : 24
}
Please let me know if there are any extension method that will allow me to perform such activity. Any pointers will be highly helpful. Thanks in advance !!!