Skip to content

Instantly share code, notes, and snippets.

@j-onathan
Created August 6, 2014 17:13
Show Gist options
  • Save j-onathan/c406fb2d1874901681af to your computer and use it in GitHub Desktop.
Save j-onathan/c406fb2d1874901681af to your computer and use it in GitHub Desktop.
public PushMessage(String jsonMessage) throws PreyException{
try {
JSONObject jsonObj = new JSONObject(jsonMessage);
JSONObject data = jsonObj.getJSONObject("data");
this.event = jsonObj.getString("event");
this.type = data.getString("type");
this.body = data.getString("body");
} catch (JSONException e) {
throw new PreyException("Couldn't parse pushed json message");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment