在JSP中替代使用json_encode

时间:2016-07-22 03:53:14

标签: android jsp

我正在开发android应用程序,我正在使用jsp进行mysql连接。在JSP中使用json_encode的另一种方法是什么?因为它专用于PHP。

1 个答案:

答案 0 :(得分:0)

尝试使用php中的json_encoded,它可以正常工作

 <%@page contentType="text/html; charset=UTF-8"%>
    <%@page import="org.json.simple.JSONObject"%>
    <%
        JSONObject json = new JSONObject();
        json.put("name", "john");
        json.put("mobile", "999999999");
        out.print(json);
        out.flush();
    %>