Maven: <dependency> <groupId>io.github.benas.json.shapeshifter</groupId> <artifactId>json-shapeshifter-core</artifactId> <version>1.0.0</version> </dependency> Gradle: groovy dependencies { implementation 'io.github.benas.json.shapeshifter:json-shapeshifter-core:1.0.0' } Shapeshifter shapeshifter = Shapeshifter.from(jsonString); String name = shapeshifter.getString("name"); int age = shapeshifter.getInt("age"); List<String> hobbies = shapeshifter.getList("hobbies", String.class); Shapeshifter shapeshifter = Shapeshifter.createObject() .put("name", "John Doe") .put("age", 30) .put("hobbies", Shapeshifter.createArray().add("reading").add("coding")); String jsonString = shapeshifter.toJsonString();


上一篇:
下一篇:
切换中文