Skip to content

Instantly share code, notes, and snippets.

@tarek360
Last active June 8, 2017 09:24
Show Gist options
  • Save tarek360/3d51225295ae0594743362dcd1008b89 to your computer and use it in GitHub Desktop.
Save tarek360/3d51225295ae0594743362dcd1008b89 to your computer and use it in GitHub Desktop.
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("modelNumber", modelNumber);
jsonObject.put("maxSpeed", maxSpeed);
jsonObject.put("color", color);
jsonObject.put("manufacturer", manufacturer);
jsonObject.put("style", style);
jsonObject.put("price", price);
} catch (JSONException e) {
e.printStackTrace();
}
return jsonObject;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment