No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-04-12 20:14:37 +02:00
core add support for StringTemplates 2025-04-12 20:14:37 +02:00
gradle add JsonTokenizer 2025-04-12 20:09:20 +02:00
.gitignore initial commit 2025-04-12 19:54:39 +02:00
gradlew initial commit 2025-04-12 19:54:39 +02:00
gradlew.bat initial commit 2025-04-12 19:54:39 +02:00
README.md add support for StringTemplates 2025-04-12 20:14:37 +02:00
settings.gradle.kts initial commit 2025-04-12 19:54:39 +02:00

json

A simple JSON library with support for StringTemplates which were available in JDK 21 and 22 as a preview feature and removed again in JDK 23. The library allows placeholders to be used as keys, values and inside strings.

Example

var parameter = "numbers";
var value = List.of(1, 2, 3, 4);
var name = "World";

var json = JSON_OBJECT."""
    {
        \{parameter}: \{value},
        "string": "Hello \{name}!"
    }
    """;

assertEquals(3, json.getArray("numbers").getNumber(2));
assertEquals(JsonString.valueOf("Hello World!"), json.get("string"));

System.out.println(json.toPrettyJsonString());
// {
//     "numbers": [1, 2, 3, 4],
//     "string": "Hello World!"
// }