私はrestServiceを書きました、そして私のサービスは私に2つの異なる結果を返します:
{"Response": {
"cars":[
{"id":"1",
"name":"test1"},
{"id":"2",
"name":"test2"},
{"id":"3",
"name":"test3"}
],
"books":[
{"id":"4",
"name":"example1"},
{"id":"5",
"name":"example2"},
{"id":"6",
"name":"example3"}
]}}
そして第二に、
{"Response": {
"cars":{
"id":"1",
"name":"test1"},
"books":{
"id":"4",
"name":"example1"}
}}
javascript を使用して dataTable に結果を表示します。そのために、車や本の長さを知りたいです。結果>1が長さを取得できる場合、車または本は配列として機能しますが、結果が<1オブジェクトとして機能し、オブジェクトの長さを取得できない場合。私のrestServiceではArrayList、車と本として定義しました。これに対する解決策はありますか?回答ありがとうございます。