0
Webサービス呼び出しで、レスポンスが単一の要素を含むリストである場合、REST WebサービスはJSON配列ではなくJSONオブジェクトを返します。どうすれば配列を返すことができますか?Rest WebサービスがJSON配列を返さない
@GET
@Produces("application/json")
@Path("/chekinList")
public List<LocationReguest> getChekinList(@FormParam("childID") String userName,@FormParam("appkey") String appkey,@FormParam("appPassword") String appPassword) // Getting the list of check in list
{
LocationController locationController = new LocationController(); //Controller object
List<LocationReguest> locreqlist = locationController.getChekinList(userName); //Calling controller function
return locreqlist; //return proper representation object
}
例:持つ
JSONオブジェクト出力1つのオブジェクト複数のオブジェクトを持つ
{"childRequest":{"childName":"test123Child","childUserName":"add"}}
JSONオブジェクト配列出力:
{"childRequest":[{"childName":"Child ONE","childUserName":"chlid1"},{"childName":"abayakoon","childUserName":"abey"}]}