{
"name" : "王小二",
"age" : 25.2
"birthday" : "1990-01-01",
"school" :"藍翔",
"major":["理發","挖掘機"],
"has_grlfrend":false,
"car":null,
"house":null,
"comment":"這是一個注釋"
}
json中沒有注釋一說,若要注釋添加comment
"name" : "王小二",
"age" : 25.2
"birthday" : "1990-01-01",
"school" :"藍翔",
"major":["理發","挖掘機"],
"has_grlfrend":false,
"car":null,
"house":null,
"comment":"這是一個注釋"
}
json中沒有注釋一說,若要注釋添加comment
2019-02-20
最贊回答 / qq_a沙漏中的時光_0
把
jsonContent.json
放到resouces?路徑下。在如下讀取 File?file?=?new?File(ReadJsonSample.class.getClassLoader().getResource("./jsonContent.json").getPath());<...code...>
2019-02-15
初學java 感覺java的json這么麻煩,不像其他語言有個方法,去轉。 要引入這個引入那個,然后我自己封裝了一個encode 和 decode 還在測試中,只用到hashMap 和ArrayList。測試好后面會發上來
2018-12-26
最贊回答 / 烈焰狂歌
出現這個錯誤的原因是因為引入的json jar包太老了? ? ? ?<dependency>? ? ? <groupId>org.json</groupId>? ? ? <artifactId>json</artifactId>? ? ? <version>20160810</version>? ? </dependency>如圖,把pom.xml文件中的引用改成我上面這個就行了,也就會把原來的?<ver...
2018-08-26