Repository navigation
SkJson 6.0.0 — HTTP reliability and core JSON
SkJson 6.0.0 builds on the 5.6 baseline and focuses on outgoing HTTP reliability and core JSON path APIs.
Important
SkJson 6.0.0 requires Skript 2.15.0 or newer. It will not load on Skript 2.14 or older.
Note
SkJson handles outgoing HTTP requests (execute {_request} / on received http response). It does not provide an embedded web server or incoming request syntax such as reply … with ….
Requirements
| Java | 21+ (CI: 25) |
| Minecraft | 1.16.5+ (CI: Paper 26.2) |
| Skript | 2.15.0+ (tested with 2.15.4) |
| Optional | NBT-API (shaded in jar) |
Recommended stack: Paper 1.21.x+, Java 21+, Skript 2.15.4+.
What's new in 6.0.0
HTTP module
- Query parameters —
key:valuepairs support values that contain colons; multipleadd "key:value" to query params of {_req}calls compose correctly - MOCK method —
prepare MOCK request on …returns a local synthetic200response ({"mock":true}) without a network call (blocking and non-blocking) - Full method coverage — GET, POST, PUT, PATCH, DELETE, HEAD, MOCK, plus
json from website - Non-blocking requests —
execute {_req} as non blockingwithon received http response - Configurable client — shared HTTP client with connect/response timeouts and thread pool in
config.yml
Recommended syntax for multiple query params:
reset query params of {_req}
add "skjson:demo" to query params of {_req}
add "probe:1" to query params of {_req}
set {_req}'s headers to json from "{'Accept':'application/json','X-Test':'ok'}"Core JSON
set value at path … in … to …— dedicated path write effectremove path … from …/delete path … in …— delete nested keys without rebuilding the document.jsoncfiles — line/block comments and trailing commas stripped before parse- Performance — fast-path primitive parsing, bounded path token cache, NBT conversion LRU cache (configurable in
config.yml)
Bug fixes (since 5.6.0)
HTTP
-
Query params — multiple
key:valuepairs no longer collapse into one broken URL key. Prefer adding parameters one at a time:reset query params of {_req} add "skjson:demo" to query params of {_req} add "probe:1" to query params of {_req}
-
MOCK requests —
prepare MOCK request on …followed byexecute {_req}returns local JSON without opening a socket:set {_req} to prepare MOCK request on "https://example.com/status" execute {_req} set {_res} to last response of {_req}
-
HEAD responses —
prepare HEAD request on …/execute {_req}correctly yields an empty body; do not assume%body of {_res}%is JSON.
Syntax and behaviour
set value at path … in … to …— path writes use a dedicated effect instead of slower generic settersremove path … from …/delete path … in …— nested keys can be removed without rebuilding the whole documenthas path/contains path— probing a missing key does not spam warnings to the consoleloop values of {_json}:— iterates object/array entries (%json-key-1%,%json-value-1%), not a single wrapped value.jsoncfiles —json from fileand bind/watch flows accept.jsonclike.json
Performance bottlenecks
- JSON primitives —
parse "…" as jsonand numeric/boolean literals skip unnecessary Gson round-trips on the hot path - Path reads — repeated
value at path "…" in {_json}/path "…" of {_json}reuse a bounded path-token cache (size inconfig.yml) instead of re-tokenizing every access - Array index paths —
value at path "items.0.name" in {_json}resolves array segments with integer parsing; read mode no longer mis-navigates array indices - Path writes —
set value at path "…" in {_json} to …avoids extra allocation in high-frequency update loops - Object key pickers —
last key of {_json}and indexed/random key access no longer copy entire entry sets on each call - File watcher — bind/watch reload compares compact snapshots (hash before full string equality) so unchanged saves do not trigger redundant cache refresh
- File I/O — JSON serialization for disk writes reuses a shared serializer instance instead of creating one per write
- NBT conversion — optional NBT → JSON uses an LRU cache (size in
config.yml) to cut repeat conversion cost on items, chunks, and entities
Examples
# --- HTTP GET with query params ---
set {_req} to prepare GET request on "https://api.example.com/get"
reset query params of {_req}
add "skjson:demo" to query params of {_req}
add "probe:1" to query params of {_req}
set {_req}'s headers to json from "{'Accept':'application/json'}"
execute {_req}
set {_res} to last response of {_req}
set {_body} to parse "%body of {_res}%" as json
send "args: %value at path ""args"" in {_body}%" to player
# --- MOCK (no network) ---
set {_req} to prepare MOCK request on "https://example.com/get"
execute {_req}
set {_res} to last response of {_req}
assert status code of {_res} is 200
# --- Async ---
set {_req} to prepare GET request on "https://api.example.com/status"
execute {_req} as non blocking
on received http response:
set {_res} to event-response
broadcast "API status: %status of {_res}%"
# --- Path write / remove ---
set {_cfg} to json from "{user: {name: ""Alex""}}"
set value at path "user.name" in {_cfg} to "Bob"
remove path "user.role" from {_cfg}Upgrade guide (from 5.6.0)
- Replace
skjson.jarinplugins/(keep a single copy — duplicate jars cause load warnings). - Restart the server (recommended after any SkJson update).
- If you use HTTP query params, prefer
add "key:value" to query params of {_req}instead of comma/andlists onset query params of {_req}. - Enable HTTP in
plugins/SkJson/config.ymlif needed:enabled-http: true.
Install
- Download
skjson.jarfrom the release assets below. - Place it in
plugins/(Skript 2.15+ must already be installed). - Restart the server.
- Review
plugins/SkJson/config.yml(HTTP, NBT, watcher, cache sizes).
Project links
| Resource | Link |
|---|---|
| Wiki | github.com/cooffeeRequired/skJson/wiki |
| Issues | github.com/cooffeeRequired/skJson/issues |
| Performance notes | performance.md |
Full Changelog: 5.6.0...6.0.0