0

Trying to decode json from fcm when there are no slashes on the json value it works by not with a slash. Below is the json composition part from the php script

This works

$body="d";
$path="www.google.com";
$msg = array('body'=>$body,'path'=>$path);

This Doesnt

$body="d";
$path="www.google.com/images";
$msg = array('body'=>$body,'path'=>$path);

Json outupt from php script that doesnt works

{"data":{"body":"d","path":"www.google.com\/images"},"to":"\/topics\/test"}

App Try Block

try {
JSONObject json = new JSONObject(remoteMessage.getData().toString());

Log.e(TAG, "Data Payload: " + json.get("body"));
                                   newmessafe(json.get("body").toString(),json.getString("path").toString());

} catch (Exception e) {

Log.e(TAG, "Exception: " + e.getMessage());
}
dreamer1989
  • 1,075
  • 3
  • 12
  • 29

0 Answers0