private static <T> Map<String, Object> serializeArray(Class<?> type, T[] arr) {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("T", type.getComponentType().isPrimitive() ? type.getName() : ("[L"));
        data.put("class", arr.getClass().getComponentType().getName());
        data.put("length", arr.length);
        
        List<Object> list = new ArrayList<Object>(arr.length);
        for (Object o : arr) {
            list.add(serialize(o));
        }
        data.put("data", list);
        
        return data;
    }