public static String toCamelCase(String str) {
        if (str == null || str.isEmpty()) {
            return str;
        }
        StringBuilder stringBuilder = new StringBuilder();
        boolean foundFirstLowercase = false;
        for (char cur : str.toCharArray()) {
            if (Character.isUpperCase(cur) && !foundFirstLowercase) {
                stringBuilder.append(Character.toLowerCase(cur));
            } else {
                foundFirstLowercase = true;
                stringBuilder.append(cur);
            }
        }
        return stringBuilder.toString();
    }
This matches the algorithm that Jackson uses to convert getter names to JSON field names. Any names starting with a
lowercase character are left as is, any names starting with one or more uppercase characters have all consecutive
uppercase characters converted to lowercase. See tests for examples.

@see <a href="https://github.com/FasterXML/jackson-databind/blob/4debd67e053a254b5f42294426340fc91a312f64/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java#L233">BeanUtil.java</a>
jmespath-java/src/main/java/com/amazonaws/jmespath/CamelCaseUtils.java