1
我確實收到下面的json數據到我的一個RESTful spring web服務中。我使用spring @RequestBody從請求正文中檢索數據。數據被作爲LinkedHashMap檢索,每個Player和Fixture對象有兩個java.util.ArrayList。但問題是java.util.ArrayList(s)中的每個對象都不是Player或Fixture類型;它又是LinkedHashMap類型。是否有可能告訴Spring將數據轉換成java.util.ArrayList(s)。一個列表應該包含Player的對象,其他應該包含Fixture類型的對象。Spring @RequestBody Json到LinkedHashMap
{"Player":[
{"idPlayer":101,"FirstName":"Stevenson","LastName":"Martin"},
{"idPlayer":102,"FirstName":"Kevin","LastName":"Main"}
],
"Fixture":[
{"idFixture":1,"HomeTeamId":"2","AwayTeamId":"9"},
{"idFixture":2,"HomeTeamId":"6","AwayTeamId":"2"},
{"idFixture":3,"HomeTeamId":"5","AwayTeamId":"3"}
]
}