String text = FileUtils.readFileToString(new File("xx.txt")); String result= text.replaceAll("(//.*)|(/\\*[\\s\\S]*?\\*/)", "");//Use is removing json text/ Comment content after / and /* */. @SuppressWarnings("unchecked") Map<String,Object> map = JSON.parseObject(result, Map.class);
System.out.println(map);
ok~~~~