Code example for JsonObject

Methods: addProperty

0
 
import java.lang.reflect.Type; 
 
public class ZoneTagSerializer implements JsonSerializer<ZoneTag> {
    public JsonElement serialize(ZoneTag zoneTag, Type type, JsonSerializationContext jsonSerializationContext) {
        JsonObject obj = new JsonObject();
        obj.addProperty("serial", zoneTag.getSerial());
        obj.addProperty("description", zoneTag.getDescription());
        return obj;
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java