Code example for JsonPrimitive

0
    @Override 
    public JsonElement serialize(final DateTime src, final Type typeOfSrc, final JsonSerializationContext context) { 
 
        JsonElement element = null; 
        if (src != null) { 
            element = new JsonPrimitive(src.getMillis()); 
        } 
 
        return element; 
    } 
}