我正在尝试使用 json4s 在 Scala 应用程序中生成 JSON。相当直截了当,这是我在我的 Scalatra 应用程序中汇总的一些示例值:
import org.json4s._
import org.json4s.JsonDSL._
object JsonStub {
    val getPeople = 
        ("people" ->
            ("person_id" -> 5) ~
            ("test_count" -> 5))
}
在我的控制器中,我只有:
import org.json4s._
import org.json4s.JsonDSL._
import org.json4s.{DefaultFormats, Formats}
class FooController(mongoDb: MongoClient)(implicit val swagger: Swagger) extends ApiStack with NativeJsonSupport with SwaggerSupport {
get ("/people", operation(getPeople)) {
        JsonStub.getPeople
    }   
}
然而,我在浏览器中看到的输出如下:
{
  "_1": "people",
  "_2": {
    "person_id": 5,
    "test_count": 5
  }
}
任何线索_1和_2钥匙来自哪里?我期待的是这个输出:
{
  "people":{
    "person_id": 5,
    "test_count": 5
  }
}