Code example for Gson

Methods: toJson

0
	} 
 
	protected void sendJsonWithGson(DogShit dogshit) {
		// DogShit dogshit = new DogShit(location.getLongitude(), 
		// location.getLongitude(), new Date()); 
		Gson gson = new Gson();
 
		// Convert java object to JSON format 
		String json = gson.toJson(dogshit);
 
		sendJson(json);
	} 
 
	protected void sendJsonWithGson(Location location) {
		DogShit dogshit = new DogShit(location.getLongitude(), location
		    .getLongitude(), new Date());
		Gson gson = new Gson();
 
		// Convert java object to JSON format 
		String json = gson.toJson(dogshit);
Contextual code suggestions in your IDE  Get Codota for Java