public void print(Object unknown) throws IOException {
        if (unknown == null) {
            printNull();
        } else {
            final Class<?> type = unknown.getClass();
            if (type == String.class) {
                printString((String) unknown);
            } else if (List.class.isAssignableFrom(type)) {
                @SuppressWarnings("unchecked")
                final List<Object> list = (List<Object>) unknown;
                printList(list);
            } else if (Map.class.isAssignableFrom(type)) {
                @SuppressWarnings("unchecked")
                final Map<String, Object> map = (Map<String, Object>) unknown;
                printMap(map);
            } else if (type == Double.class) {
                printDouble((Double) unknown);
            } else if (type == Float.class) {
                printDouble(((Float) unknown).doubleValue());
            } else if (type == Long.class) {
                printLong((Long) unknown);
            } else if (type == Integer.class) {
                printLong(((Integer) unknown).longValue());
            } else if (type == Short.class) {
                printLong(((Short) unknown).longValue());
            } else if (type == Byte.class) {
                printLong(((Byte) unknown).longValue());
            } else if (type == Boolean.class) {
                printBoolean((Boolean) unknown);
            } else {
                throw new IllegalArgumentException(
                    "Can't parse unsupported type '" + type + "' into JSON."
                );
            }
        }
    }
An internal class that can serialize java objects into JSON code.

@author Emil Forslund
@since  1.0.0
common-parent/json/src/main/java/com/speedment/common/json/internal/JsonSerializer.java