You need to remove the / slashes. In java, you don't need to include / as a regex delimiter. And also you must need to escape the dots. To do a case-insensitive match, add (?i) modifier at the first.
Path.replaceFirst("(?i)(\\.jpg)\\.json", "$1");
OR
You could use lookbehind assertion also.
Path.replaceFirst("(?i)(?<=\\.jpg)\\.json", "");
(?<=\\.jpg) Asserts that the string going to be matched must be preceded by .jpg. If yes then match only the following .json string. Replacing the matched .json string with an empty string will give you the desired output.