Last active
August 29, 2015 14:24
-
-
Save eicnix/b3e8348102ad981b5919 to your computer and use it in GitHub Desktop.
Parsing nullable types with argonaut
This file contains hidden or 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
import argonaut._ | |
import Argonaut._ | |
object Main extends App{ | |
val json = "{ \"name\": \"Peter\", \"score\": null}" | |
case class Player(name: String, score: String) | |
implicit def PlayerCodecJson: CodecJson[Player] = | |
casecodec2(Player.apply, Player.unapply)("name", "score") | |
println(Parse.decode[Player](json)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment