xively

send JSON to server via HTTP put request in android

被刻印的时光 ゝ 提交于 2019-12-05 00:33:18
问题 How to wrap given json to string and send it to server via Http put request in android? This is how my json look like. { "version": "1.0.0", "datastreams": [ { "id": "example", "current_value": "333" }, { "id": "key", "current_value": "value" }, { "id": "datastream", "current_value": "1337" } ] } above is my json array. below is how I wrote the code but, its not working protected String doInBackground(Void... params) { String text = null; try { JSONObject child1 = new JSONObject(); try{

send JSON to server via HTTP put request in android

你。 提交于 2019-12-03 15:45:06
How to wrap given json to string and send it to server via Http put request in android? This is how my json look like. { "version": "1.0.0", "datastreams": [ { "id": "example", "current_value": "333" }, { "id": "key", "current_value": "value" }, { "id": "datastream", "current_value": "1337" } ] } above is my json array. below is how I wrote the code but, its not working protected String doInBackground(Void... params) { String text = null; try { JSONObject child1 = new JSONObject(); try{ child1.put("id", "LED"); child1.put("current_value", "0"); } catch (JSONException e) { // TODO Auto