I am sending json object from android as such:
//Create JSONObject here
JSONObject json = new JSONObject();
json.put("key", String.valueOf(args[0]));
String postData=json.toString();
// Send POST output.
printout = new DataOutputStream(urlConn.getOutputStream ());
printout.writeUTF(URLEncoder.encode(postData,"UTF-8"));
Log.i("NOTIFICATION", "Data Sent");
printout.flush ();
printout.close ();
When it is sent to the server it looks like the following code snippet. ???%7B%22key%22%3A%22value%22%7D
I should add the first ??? are in a diamond each. When I decode the whole json object I get null. In the php server I have
$somevar=json_decode(json, true);
which returns null. Can someone point me on how to retrieve the json value? Thanks so much:)
Aucun commentaire:
Enregistrer un commentaire