我正在使用scala进行游戏2。我有Seq命名客户,如
customers: scala.Seq[(Option[Int], String, String)]
如何将其转换为json对象? 我正在使用此代码
Json.obj(
"status" -> true,
"message" -> Json.toJson("Successful"),
"customers" -> Json.toJson(customers.toString())
)
这样可以输出
{
"status": true,
"message": "Successful",
"customers": "Vector((Some(1),ACTIVE,Md. Khairul Anam (Some(2),ACTIVE,Johirul Islam))"
}
我希望看到像
这样的输出{
"status": true,
"message": "Successful",
"customers": [
{
"id": 1,
"name": "Md. Khairul Anam "
"status": "ACTIVE"
},
{
"id": 2,
"name": "Johirul Islam"
"status": "ACTIVE"
}
]
}