Code example for JsonArray

Methods: add

0
    @Override 
    public JsonElement serialize(final LocalDate src, final Type typeOfSrc, final JsonSerializationContext context) {
 
        JsonArray array = null;
        if (src != null) {
            array = new JsonArray();
            array.add(new JsonPrimitive(src.getYearOfEra()));
            array.add(new JsonPrimitive(src.getMonthOfYear()));
            array.add(new JsonPrimitive(src.getDayOfMonth()));
        } 
 
        return array;
    } 
} 
Experience pair programming with AI  Get Codota for Java