Skip to content

Instantly share code, notes, and snippets.

@propensive
Created August 6, 2015 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save propensive/ffe59d36509cc40272b0 to your computer and use it in GitHub Desktop.
Save propensive/ffe59d36509cc40272b0 to your computer and use it in GitHub Desktop.
Rapture JSON erorrs
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import rapture.json._
import rapture.json._
scala> import jsonBackends.jawn._
import jsonBackends.jawn._
scala> case class Foo(bar: String, baz: Int)
defined class Foo
scala> case class Quux(foo: Foo, bippy: Double)
defined class Quux
scala> json"""{ "foo": { }, "bippy": 42 }"""
res0: rapture.json.Json = {"bippy":42,"foo":{}}
scala> import rapture.core.modes.returnResult._
import rapture.core.modes.returnResult._
scala> res0.as[Quux]
res1: rapture.core.Result[Quux,rapture.data.DataGetException with rapture.data.DataGetException] =
Errata(
Vector(rapture.data.DataGetException: missing value [_.foo.bar], rapture.data.DataGetException: missing value [_.foo.baz])
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment