關(guān)于fileutil讀取json文件空指針異常的解決:用json文件的絕對(duì)路徑。
String content=FileUtils.readFileToString(new File("D:/MyEclipse WorkSpace/JsonRead/src/main/java/wang.json"),"UTF-8");
String content=FileUtils.readFileToString(new File("D:/MyEclipse WorkSpace/JsonRead/src/main/java/wang.json"),"UTF-8");
2018-03-05
{
“name”:"王小二",
“age”:25,
"birthday":"1994-01-01",
"school":"北大藍(lán)翔",
"major":["理發(fā)","挖掘機(jī)"],
"has_girlfried":false,
"car":null,
"house":null,
"comment":"這是一個(gè)注釋"
}
“name”:"王小二",
“age”:25,
"birthday":"1994-01-01",
"school":"北大藍(lán)翔",
"major":["理發(fā)","挖掘機(jī)"],
"has_girlfried":false,
"car":null,
"house":null,
"comment":"這是一個(gè)注釋"
}
2018-02-02