将一个具有多个JSArray的JSON传递到一个case类中,我需要获取JSArray中一个元素的值并将该值分配给变量。
case class ReportsFields(
reportid: Option[Long],
Columns: List[SelectedColumns],
groupBy: List[GroupByFields],
report_data: Option[JsArray],
header :Option[JsArray],
)
JSON
{
"cubeid": 12378128388011,
"categoryName": "CustomeTextFeature",
"reports": [
{
"selectedColumns": [
{
"field": "hospitalgroupidEHI_0bA",
"selectedCubeColumnId": 4705=
},
{
"field": "dischargedetailEHI_1MA",
"selectedCubeColumnId": 4706
}
],
"groupBy": [],
"report_data":[
{
"formatType": "text",
"value": "This is a sample text to be printed in the report"
},
{
"formatType": "text size",
"value": 12
},
{
"formatType": "text alignment",
"value" : "RIGHT"
},
{
"formatType": "page height",
"value" : "12"
},
{
"formatType": "page width",
"value" : "8"
}
],
"header": [
{
"formatType": "text",
"value": "Test"
},
{
"formatType": "font size",
"value": 12
}
]
}
]}
通过传递此Json,我想分配
"formatType": "page height",
"value" : "12"
设置为Height = 12
当我解析并获取所有JSArray值并发送失败时, 有什么想法吗?