Less is more. Simplicity is the ultimate sophistication.
Zson is a minimalist, pure Java JSON library.
- Zero dependencies
- Secure and reliable (JDK8+)
- High performance
- Minimal API
Works with JDK8 and above. Security and efficiency are first-class citizens.
In a complex world, choose simplicity.
Do one thing well: JSON parsing and serialization.
import org.zouzanyan.json.Zson;
String json = """
{
"user": {
"name": "Alice",
"age": 28,
"address": {
"city": "Shanghai",
"zip": "200000"
},
"tags": ["developer", "java", "minimalist"]
},
"scores": [95, 88, 76],
"active": true
}
""";
ZsonValue root = Zson.parse(json);
// Chain access
String name = root.key("user").key("name").as(String.class);
int age = root.key("user").key("age").as(Integer.class);
String city = root.key("user").key("address").key("city").as(String.class);
String tag0 = root.key("user").key("tags").index(0).as(String.class);
// Path access
int score1 = root.path("scores[1]").as(Integer.class);
String zip = root.path("user.address.zip").as(String.class);
boolean active = root.path("active").as(Boolean.class);
// Serialize
String jsonOut = Zson.stringify(root);Zson.parse(String)Parse JSON stringZsonValue.key(String)Access object propertyZsonValue.index(int)Access array elementZsonValue.path(String)Path accessZson.stringify(Object)Object to JSON string
- No type guessing, no magic
- No hidden exceptions, no ambiguity
- No third-party dependencies, no risk
- Not the most features, just the least expression
Maven:
<dependency>
<groupId>org.zouzanyan</groupId>
<artifactId>zson</artifactId>
<version>1.0.0</version>
</dependency>Gradle:
implementation 'org.zouzanyan:zson:1.0.0'- Config parsing
- Data exchange
- Log processing
- Anywhere simple, safe, reliable JSON is needed
Purity is the highest form of complexity.
Zson — For JSON, and nothing else.