使用spray-json将嵌套的case类转换为JSON

时间:2014-12-07 21:27:37

标签: json scala spray-json

如果我有嵌套的case类,如何使用spray-json将它们转换为JSON?

例如,我的结构类似于:

case class MyObj1(name: String, myObject2: MyObject2)
case class MyObj2(myObjec3s: Seq[MyObj3])
case class MyObj3(name1: String, name2: String)

The json would look something like:
{
  "name": "",
  "myObject2": [ { "name1": "", "name2": "" }, { "name1": "", "name2": "" }, .... ]
}

0 个答案:

没有答案