Json Hook [Skript Reflect | No Extra Addons]

Script Json Hook [Skript Reflect | No Extra Addons] 1.0

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

Supported Skript Version
  1. 2.12
Supported Minecraft Versions
  1. 1.21

Skript JSON Hook (Reflect-based)​

This is a powerful, lightweight JSON hook written entirely in Skript using skript-reflect, built for developers who want full, low-level control over JSON without relying on heavy external addons or compiled plugins.

By directly interfacing with Java’s JSON classes through reflect, this hook delivers fast, reliable JSON parsing and manipulation while keeping server overhead to an absolute minimum. You stay fully inside the Skript ecosystem, but gain the flexibility and performance typically reserved for Java plugins.

The hook is designed to be clean, predictable, and scalable. It supports deep path access, object and array manipulation, file I/O, and string serialization — making it ideal for:

  • API integrations
  • Advanced configuration systems
  • Persistent data storage
  • Web requests & responses
  • Complex player or server data

Included Functions (31 Total)​

All functions are grouped logically to keep usage intuitive and readable.


File Operations​

loadJSON(path: string) :: object
Loads a JSON file from disk and returns it as a JsonObject you can work with in Skript.

saveJSON(path: string, json: object)
Saves a JsonObject to disk using pretty formatting (readable, indented).

saveJSONCompact(path: string, json: object)
Saves a JsonObject to disk in compact format (no unnecessary whitespace, smaller file size).


Get Operations​

jsonGetString(json: object, path: string) :: string
Gets a string value from a JSON object using a path (e.g. "player.name").

jsonGetInt(json: object, path: string) :: integer
Gets an integer value from the specified path.

jsonGetBoolean(json: object, path: string) :: boolean
Gets a boolean value (true / false) from the path.

jsonGetObject(json: object, path: string) :: object
Returns a nested JsonObject at the given path.

jsonGetArray(json: object, path: string) :: object
Returns a JsonArray stored at the given path.

jsonGetArraySize(json: object, path: string) :: integer
Returns how many elements are inside the array at the path.


✏️ Set Operations​

jsonSetString(json: object, path: string, value: string)
Sets or replaces a string value at the given path.

jsonSetInt(json: object, path: string, value: integer)
Sets or replaces an integer value at the path.

jsonSetBoolean(json: object, path: string, value: boolean)
Sets or replaces a boolean value at the path.

jsonSetObject(json: object, path: string, value: object)
Inserts a JsonObject at the given path.

jsonSetArray(json: object, path: string, value: object)
Inserts a JsonArray at the given path.

If the path doesn’t exist, it is created automatically.

Array Operations​

jsonArrayAddString(array: object, value: string)
Adds a string to the end of a JsonArray.

jsonArrayAddInt(array: object, value: integer)
Adds an integer to the array.

jsonArrayAddBoolean(array: object, value: boolean)
Adds a boolean to the array.

jsonArrayAddObject(array: object, value: object)
Adds a JsonObject to the array.

jsonArrayGet(array: object, index: integer) :: object
Returns the raw element at the given index.

jsonArrayGetString(array: object, index: integer) :: string
Gets a string value from the array at the index.

jsonArrayGetInt(array: object, index: integer) :: integer
Gets an integer value from the array at the index.

jsonArrayGetObject(array: object, index: integer) :: object
Gets a JsonObject from the array at the index.

jsonArrayRemove(array: object, index: integer)
Removes the element at the specified index.

jsonArrayClear(array: object)
Removes all elements from the array.


Utility Operations​

jsonHas(json: object, path: string) :: boolean
Checks whether a key exists at the given path.

jsonRemove(json: object, path: string)
Deletes the key and its value at the path.

jsonToString(json: object) :: string
Converts a JsonObject into a pretty-formatted JSON string.

jsonToStringCompact(json: object) :: string
Converts a JsonObject into a compact JSON string.

jsonParse(text: string) :: object
Parses a raw JSON string into a JsonObject.

jsonNew() :: object
Creates and returns a new empty JsonObject {}.

jsonNewArray() :: object
Creates and returns a new empty JsonArray [].


Made by Zin
Description written by ChatGPT
Author
Zin
Downloads
170
Views
476
First release
Last update
Rating
0.00 star(s) 0 ratings