private RowDataToFieldConverter createMapConverter(
            String typeSummary, LogicalType keyType,
            LogicalType valueType) {
        if (!keyType.is(LogicalTypeFamily.CHARACTER_STRING)) {
            throw new UnsupportedOperationException(
                    "JSON format doesn't support non-string as key type of map. The type is: " + typeSummary);
        }
        final RowDataToFieldConverter valueConverter = createConverter(valueType);
        final ArrayData.ElementGetter valueGetter = ArrayData.createElementGetter(valueType);
        return inputObj -> {
            MapData map = (MapData) inputObj;
            ArrayData keyArray = map.keyArray();
            ArrayData valueArray = map.valueArray();
            int numElements = map.size();
            Map<String, Object> output = new HashMap<>();
            for (int i = 0; i < numElements; i++) {
                String fieldName;
                if (keyArray.isNullAt(i)) { // when map key is null
                    switch (mapNullKeyMode) {
                        case LITERAL:
                            fieldName = mapNullKeyLiteral;
                            break;
                        case DROP:
                            continue;
                        case FAIL:
                            throw new RuntimeException(
                                    String.format("JSON format doesn't support to serialize map data with null keys."
                                            + " You can drop null key entries or encode null in"
                                            + " literals by specifying %s option.",
                                            MAP_NULL_KEY_MODE.key()));
                        default:
                            throw new RuntimeException(
                                    "Unsupported map null key mode. Validator should have checked that.");
                    }
                } else {
                    fieldName = keyArray.getString(i).toString();
                }

                Object value = valueGetter.getElementOrNull(valueArray, i);
                output.put(fieldName, valueConverter.convert(value));
            }

            return output;
        };
    }
Creates a runtime converter which assuming input object is not null.
inlong-sort/sort-formats/format-rowdata/format-rowdata-json/src/main/java/org/apache/inlong/sort/formats/json/RowDataToFieldConverters.java