Gson 是 Google 开源的一个 Java 库,用于处理 JSON 数据。
源码地址: https://github.com/google/gson/
若无特殊说明,本系列文章使用的是:
- JDK 17
- Gradle 7
若无特殊说明,build.gradle 配置如下:
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
mavenCentral()
}
dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testCompileOnly 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
test {
useJUnitPlatform()
}