java读取json格式的文件
public static String getJson() {
String jsonStr = "";
try {
File file = new File(" ");
FileReader fileReader = new FileReader(file);
Reader reader = new InputStreamReader(new FileInputStream(file),"Utf-8");
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) {
sb.append((char) ch);
}
fileReader.close();
reader.close();
jsonStr = sb.toString();
return jsonStr;
} catch (Exception e) {
return null;
}
}
json转map
转载
https://www.cnblogs.com/heqiyoujing/p/9432153.html