Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MagicJSON
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
You can’t perform that action at this time.