private String jsonReplace(String jsonDoc, ArrayList<Object> pathValuePairs) {
        if (jsonDoc == null || pathValuePairs == null || pathValuePairs.size() % 2 != 0) {
            return null;
        }

        Object json = JSON.parse(jsonDoc);

        for (int i = 0; i < pathValuePairs.size(); i += 2) {
            String path = (String) pathValuePairs.get(i);
            Object value = pathValuePairs.get(i + 1);

            // If the path is' $', replace the entire JSON directly
            if (path.equals("$")) {
                try {
                    json = JSON.parse(value.toString());
                } catch (Exception ignored) {
                    json = value;
                }
            } else if (path.contains("*") || path.contains("**")) {
                throw new IllegalArgumentException("Invalid path expression: " + path);
            } else {
                // If the path exists, replace the corresponding value. If the path does not exist, ignore it
                if (JSONPath.contains(json, path)) {
                    try {
                        JSONPath.set(json, path, JSON.parse(value.toString()));
                    } catch (Exception ignored) {
                        JSONPath.set(json, path, value);
                    }
                }
            }
        }
        return json.toString();
    }
JsonReplaceFunction   ->  JSON_REPLACE(json_doc, path1, val1[, path2, val2, ...] ):
description:
- Return NULL if any argument is NULL;
- Return the result of replacing existing values in 'json_doc'.
Note: An error occurs if the 'json_doc' argument is not a valid JSON document or any path argument is not a valid
      path expression or contains a * or ** wildcard.
inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/json/JsonReplaceFunction.java