Last active
April 15, 2018 09:45
-
-
Save anuragsrivastava06/d5792305a56730e33f2be5d841ecc368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit def optionWriter[A] | |
(implicit writer: JsonWriter[A]): JsonWriter[Option[A]] = | |
new JsonWriter[Option[A]] { | |
def write(option: Option[A]): Json = | |
option match { | |
case Some(aValue) => writer.write(aValue) | |
case None => JsNull | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment