@Override
    public void serialize(Object value, JsonGenerator generator, boolean writeStartAndEnd) throws IOException {
        if (value == null) {
            generator.writeNull();
        } else if (value instanceof String) {
            generator.writeString((String)value);
        } else if (value instanceof Integer) {
            generator.writeNumber((Integer)value);
        } else if (value instanceof Long) {
            generator.writeNumber((Long)value);
        } else if (value instanceof Float) {
            generator.writeNumber((Float)value);
        } else if (value instanceof Double) {
            generator.writeNumber((Double)value);
        } else if (value instanceof Boolean) {
            generator.writeBoolean((Boolean)value);
        } else if (value instanceof List) {
            LoganSquare.mapperFor(List.class).serialize((List<Object>)value, generator, writeStartAndEnd);
        } else if (value instanceof Map) {
            LoganSquare.mapperFor(Map.class).serialize((Map<String, Object>)value, generator, writeStartAndEnd);
        } else {
            Class valueClass = value.getClass();
            JsonMapper jsonMapper = LoganSquare.mapperFor(valueClass);

            if (jsonMapper != null) {
                if (writeStartAndEnd) {
                    generator.writeStartObject();
                }

                jsonMapper.serialize(value, generator, false);

                if (writeStartAndEnd) {
                    generator.writeEndObject();
                }
            }
        }
    }
Built-in mapper for unknown types
core/src/main/java/com/bluelinelabs/logansquare/internal/objectmappers/ObjectMapper.java