public static void main(String[] args) throws Exception {
File file = new File(ReadJSONSample.class.getResource("/wangxiaoer.json").getFile());
String content = FileUtils.readFileToString(file);
JSONObject json = new JSONObject(content);
System.out.println("姓名是:" + json.getString("name"));
}
你的wangxiaoer.json里面格式可能有问题,比如引号,逗号,括号