Domanda

I am trying to extract JSON into a case class using lift-json. Here is my case class:

case class Person(name: String, age: Int)

Here is the json

{ "name": "Some Name", "age": 24, type: "Student" }

How can I extract the type field into an instance Person?

json.extract[Person]
È stato utile?

Soluzione

Backticks allow you to use reserved names.

case class Person(name:String, age:Int, `type`:String)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top