我正在尝试将jsonArray发布到php服务器但是在发布org.json.JSONArray时收到错误无法转换为JSON对象
请让我知道这个问题
JSONArray jArr = SubstationDb.getResults(); Ë JSONObject postDataParams = new JSONObject(jArr.toString());
JSONArray data = postDataParams.getJSONArray("");
for(int i=0;i<=jArr.length();i++)
{
JSONObject c = data.getJSONObject(i);
postDataParams.putOpt("did",c.getString("did"));
postDataParams.put("bid",c.getString("bid"));
postDataParams.put("vid", c.getString("vid"));
postDataParams.put("substn_name", c.getString("substn_name"));
postDataParams.put("sub_height", c.getString("sub_height"));
postDataParams.put("latitude", c.getString("latitude"));
postDataParams.put("longitude", c.getString("longitude"));
postDataParams.put("serial_number", c.getString("serial_number"));
postDataParams.put("nickname", c.getString("nickname"));
postDataParams.put("substn_pic", c.getString("substn_pic"));
postDataParams.put("substn_status", c.getString("substn_status"));
postDataParams.put("uploadedtime", c.getString("uploadedtime"));
postDataParams.put("sid", c.getString("sid"));
}
答案 0 :(得分:0)
JSONArray postDataParams = new JSONArray();
首先创建一个postDataParams数组,然后将其推送到JSONObject并将其发送到后端。