开发者

Lift-json extract json with 'type' field into a case class

开发者 https://www.devze.com 2023-04-05 12:02 出处:网络
I am trying to extract JSON into a case开发者_StackOverflow中文版 class using lift-json. Here is my case class:

I am trying to extract JSON into a case开发者_StackOverflow中文版 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]


Backticks allow you to use reserved names.

case class Person(name:String, age:Int, `type`:String)
0

精彩评论

暂无评论...
验证码 换一张
取 消