This is my java object:
public class Photo {
private String date;
private GPS gps;
private long task_id;
private long pgo_id;
private long load_id;
private long com_id;
private long note_id;
private String note;
private String path;
}
public class GPS {
private double lon;
private double lat;
}
And I want to create a json from object photo. I did this:
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
String jsonObject = gson.toJson(photos);
But, it creates a json with all parameters. Sometimes I don't have to send GPS gps and com_id and this method put a 0. I don't want to send this parameters to json.