Skip to content

Instantly share code, notes, and snippets.

@tarek360
Created June 8, 2017 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarek360/20c229436a2b340b12a77e970818f3e2 to your computer and use it in GitHub Desktop.
Save tarek360/20c229436a2b340b12a77e970818f3e2 to your computer and use it in GitHub Desktop.
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