private static Map<Object, Object> decodeObjectMap(Type keyType,
Type valueType, JSONValue jsonValue,
ApplicationConnection connection) {
Map<Object, Object> map = new HashMap<Object, Object>();
JSONArray mapArray = (JSONArray) jsonValue;
JSONArray keys = (JSONArray) mapArray.get(0);
JSONArray values = (JSONArray) mapArray.get(1);
assert (keys.size() == values.size());
for (int i = 0; i < keys.size(); i++) {
Object decodedKey = decodeValue(keyType, keys.get(i), null,
connection);
Object decodedValue = decodeValue(valueType, values.get(i), null,
connection);
map.put(decodedKey, decodedValue);
}