Skip to content
coffeeRequired edited this page Feb 21, 2025 · 14 revisions

SkJson

Introduction

What is SkJson?

Note

  • Most Skript users are well aware that, by default, Skript only allows player data to be stored using variables (e.g., {money.%player's uuid%}). These variables are saved in a .csv table, which can become extremely cluttered and difficult to manage. SkJson is an add-on for Skript that provides comprehensive file management capabilities. It enhances Skript by enabling the storage and processing of player and server data using JSON files.

  • SkJson is a tool developed for SkriptLang, which extends the above mentioned > SkriptLang by the possibility of processing .json|.jsonc file, it allows to > serialize/deserialize various objects that are freely available in MC, it is also > possible to read and write files or to link files to the so-called cache.

  • As for the mentioned Cache, it serves as a place in ram memory from where writing > and reading different files is extremely fast, and allows easy manipulation of files > directly in the code.

  • Skjson also supports working with WebRequests and hence you can send web > requests of type POST, GET, PUT, PATCH, HEAD, MOCK, DELETE directly from the > Script and process the response directly.

You could do your own player statistics system with SkJson:

{
  "players": {
    "933334f8-a330-4551-81dd-aafb677a8186": {
      "name": "ExCorde",
      "money": 500.0,
      "group": "admin"
    }
  }
}

Different data types supported by SkJson:

{
    "object": {},
    "array": [],
    "string": "Hello world!",
    "integer": 1,
    "float": 1.1,
    "boolean": true,
    "null": null
}
  • As for the .jsonc format, it is similar, but it can also contain comments
  • ❗❗ JSONC is not yet available, but is planned for SkJson 4.6
{
    // this serves as a sample JSONC
    "object": {}, // this is an object
    "array": [], // this is an array
    "string": "Hello world!",
    "integer": 1,
    "float": 1.1,
    "boolean": true,
    "null": null
}

Usage of SkJson

Important