0
我需要发送JSON对象作为字符串到我的服务器,我这样做:JSON发送到服务器
json.put("TYPE", "1");
json.put("CODE", "0");
json.put("NODEID", id);
json.put("TSTAMP", mtemporal);
json.put("XPOS", lastx);
json.put("YPOS", lasty);
json.put("HDOP", "");
telo=json.toString();
其中TELO是一个字符串。当我在我的服务器发送TELO我获得此:
Object {command: "MESSAGE", headers: Object, body: "[Ljava.lang.String;@429106c0", id: undefined, receipt: undefined…}
的问题是,在身体应该出现的JSON对象,并出现类似地址存储
我该怎么解决呢?
Thansk
[编辑]
我更新后..我发送JSON对象,真的字符串,使用Gozirra API,允许至极连接并使用STOMP协议
将数据发送到服务器的ActiveMQ更多代码:
public void send(float lastx,float lasty,String id,String mtemporal) {
try {
json.put("TYPE", "1");
json.put("CODE", "0");
json.put("NODEID", id);
json.put("TSTAMP", mtemporal);
json.put("XPOS", lastx);
json.put("YPOS", lasty);
json.put("HDOP", "");
telo=json.toString();
}
catch (JSONException e) {
e.printStackTrace();
}
new Send().execute(telo);
}
public class Send extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... params) {
Log.i("telo", "estoy para enviar");
c.begin();
c.send("/topic/LOCATIONJSON", String.valueOf(params));
c.commit();
return null;
}
}
你是如何发送json的? –
这是String []的默认toString()输出。我们需要看到更多的代码。 – jgitter
我更新了帖子..我使用Gozirra API发送Json对象,真是一个字符串,允许使用STOMP协议连接并发送数据到activemq服务器 – user3243651