private static <K, V> Map<String, Object> serializeMap(Map<K, V> map) {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("T", "L");
        data.put("class", map.getClass().getName());
        
        List<List<Object>> pairs = new ArrayList<List<Object>>(map.size());
        for (Map.Entry<K, V> entry : map.entrySet()) {
            List<Object> pair = new ArrayList<Object>(2);
            pair.add(serialize(entry.getKey()));
            pair.add(serialize(entry.getValue()));
            pairs.add(pair);
        }
        data.put("data", pairs);
        
        return data;
    }