net.at.json.JSONException

时间:2023-05-08 15:15:44

1、错误描述

严重:Servlet.service() for servlet [clientServlet] in context with path [/User] threw exception

net.at.json.JSONException:JSONArray text must start with '[' at character 1 of 127.0.0.1

2、错误原因

JSONArray json = JSONArray.fromObject(ip);

在servlet传参数到Flex中,利用JSON格式传参,但是ip是一个String类型,不符合JSON对象格式

3、解决办法

在servlet中利用PrintWriter

PrintWriter out = response.getWriter();

out.println(ip);