Code example for JsonArray

Methods: add

0
 
public class CoordinateGsonConverter implements JsonSerializer<Coordinate> {
 
	@Override 
	public JsonElement serialize(Coordinate coordinate, Type srcType, JsonSerializationContext context) {
		JsonArray jsonArray = new JsonArray();
		jsonArray.add(new JsonPrimitive(coordinate.getLon()));
		jsonArray.add(new JsonPrimitive(coordinate.getLat()));
		return jsonArray;
	} 
 
} 
Connect your IDE to all the code out there  Get Codota for Java