SprayJson:对象缺少必需的成员' User $ u0020ID

时间:2015-02-03 16:43:55

标签: spray spray-json

这是我的Json

{"preview":false,"offset":0,"result":{"User ID":"ab192013","IP    
   Address":"101.2.0.11"}}

我有两个案例类

   case class Sample(result: Result)
   case class Result(`User ID` : String , `IP Address`: String)

   object MyResultJsonProtocol extends DefaultJsonProtocol {
   implicit val ResultFormat = jsonFormat2(Result.apply)

   implicit def sampleFormat[jsonformat] = jsonFormat1(Sample.apply)
   }

我无法获得用户ID值

请帮助,我得到以下例外

MalformedContent(Object is missing required member 'User$u0020ID',Some(spray.json.DeserializationException: Object is missing required member 'User$u0020ID'))

0 个答案:

没有答案