是什么 ? | : | a Java serialization/deserialization library to convert Java Objects into JSON and back. |
开发语言 | : | Java |
开发公司 | : | Google |
源码仓库 | : | https://github.com/google/gson |
dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
}
dependencies {
implementation("com.google.code.gson:gson:2.8.5")
}
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
Annotation
:
其他:
示例:
示例:
val json = """{"":10, "name":"内蒙古", cities:["呼和浩特", "鄂尔多斯", "包头"]}"""
val map = Gson().fromJson<Map<Any, Any>>(json, Map::class.java)
Logger.i("XX", "map = $map")