[Solved] write javaBean error, fastjson version 1.2.76, class org.apache.flink.table.data.binary

An exception is thrown when using the static variable Map as a return

com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.76, class org.apache.flink.table.data.binary.BinaryStringData, fieldName : id, Memory segment does not represent off heap memory

The rest of the code remains unchanged, and only an empty new Map is returned. The result is normal, which proves that there is a problem with the encoding of the fields inside, so it can be re-encoded
for (Map<String, Object> map : FakerConstant.TABLE_ROW_DATA_RESULT) {
            Map<String, Object> m = new HashMap<>();
            map.forEach((key, value) -> {
                m.put(
                        // You need to re-encode it, otherwise it will report FastJson exception. write javaBean error, fastjson version 1.2.76
                        new String(key.getBytes(), StandardCharsets.UTF_8),
                        new String(String.valueOf(value).getBytes(), StandardCharsets.UTF_8)););
            });
            res.add(m);
        }

Read More: