Skip to content

zouzanyan/zson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 中文

Zson

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.

Philosophy

In a complex world, choose simplicity.

Do one thing well: JSON parsing and serialization.

Quick Start

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);

API

  • Zson.parse(String) Parse JSON string
  • ZsonValue.key(String) Access object property
  • ZsonValue.index(int) Access array element
  • ZsonValue.path(String) Path access
  • Zson.stringify(Object) Object to JSON string

Principles

  • No type guessing, no magic
  • No hidden exceptions, no ambiguity
  • No third-party dependencies, no risk
  • Not the most features, just the least expression

Installation

Maven:

<dependency>
    <groupId>org.zouzanyan</groupId>
    <artifactId>zson</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle:

implementation 'org.zouzanyan:zson:1.0.0'

Use Cases

  • Config parsing
  • Data exchange
  • Log processing
  • Anywhere simple, safe, reliable JSON is needed

Epilogue

Purity is the highest form of complexity.

Zson — For JSON, and nothing else.

About

A minimalist, secure, and high-performance Java JSON library for JDK8+, focused on simplicity and reliability.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages