private String jsonSet(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 (path == null || path.contains("*") || path.contains("**")) {
                throw new IllegalArgumentException("Invalid path expression: " + path);
            }
            if ("$".equals(path)) {
                json = JSON.parse(value.toString());
                continue;
            }
            // Insert or update data, if the path does not exist, insert new data
            try {
                JSONPath.set(json, path, JSON.parse(value.toString()));
            } catch (Exception ignored) {
                JSONPath.set(json, path, value);
            }
        }

        return json.toString();
    }
JsonSetFunction   ->  JSON_SET(json_doc, path, val[, path, val, ...] )
description:
- return NULL if any argument is NULL or 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;
- return the result of inserting or updating data in 'json_doc'.
inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/json/JsonSetFunction.java