Created
February 24, 2015 17:14
-
-
Save manuelbernhardt/2940c5d35c0d3e63806c to your computer and use it in GitHub Desktop.
MagicJSON
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
trait Command | |
trait Event | |
case class A(....) extends Command | |
case class B(....) extends Command | |
case class C(....) extends Command | |
case class D(....) extends Command | |
case class AA(...) extends Event | |
case class BB(...) extends Event | |
case class CC(...) extends Event | |
case class DD(...) extends Event | |
> MagicJsonLibrary.toJson(A(...)) | |
==> { "$type: "foo.bar.A", "field1": "Foo", "field2": "Bar"} | |
MagicJsonLibrary.parse("""{ "$type: "foo.bar.A", "field1": "Foo", "field2": "Bar"}""") | |
==> A(field1 = "Foo", field2 = "Bar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment