ResquestMapping JSONARRAY为空,返回false

时间:2018-09-19 12:49:23

标签: java arrays json spring rest

早上好, 我使用Spring 4创建了一个Web服务Rest,但是屏幕上的响应显示为false和空白。有人可以告诉我为什么吗?

遵循代码:

@RestController     公共类控制器{

    @RequestMapping(value = "/info/{param1}/{param2}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public List<JSONObject> search (@PathVariable(value = "param1") String param1,
            @PathVariable(value = "param2") Long param, final HttpServletRequest request)
            throws IOException, SQLException, DaoException, ForbiddenException {

        JSONObject json1 = new JSONObject();
        JSONObject json2 = new JSONObject();;
        List<JSONObject> jsonList = new ArrayList<JSONObject>();

            for(int i=0; i<=5; i++){ 

                json1.put("JSON1", myrequest1);
                json2.put("JSON2", myrequest2);

                jsonList.add(json1);
                jsonList.add(json2);

            }

        return jsonList; >>>>>>Here json appears filled in correctly
    }

邮递员中:

[
    {
        "empty": false
    },
    {
        "empty": false
    },
    {
        "empty": false
    },
    {
        "empty": false
    },
    {
        "empty": false
    },
    {
        "empty": false
    }
]

0 个答案:

没有答案