avoiding null values in asJson method

65 views
Skip to first unread message

Mohsen Jamali

unread,
Jun 26, 2014, 5:24:15 PM6/26/14
to argona...@googlegroups.com
One of the fields in my case class is an option (e.g. case class Person(name:String,gender:Option[String]) ). I want a way that when 'gender' is None, the method person.asJson does not contain gender:null in it, but just have one attribute in it (the name attribute).


Thanks!
Mohsen

Gary Pamparà

unread,
Jun 26, 2014, 11:32:29 PM6/26/14
to argona...@googlegroups.com
Please paste some code so that we can see how you are currently doing this.

You're most likely looking for the `:=?` operator for building up the json, based on a codec.


--
You received this message because you are subscribed to the Google Groups "argonaut-json" group.
To unsubscribe from this group and stop receiving emails from it, send an email to argonaut-jso...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages