1. 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 comminuty!

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

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Addon skJson 2.8.5

Working with json in skript

  1. CoffeeRequired
    Contributors:
    CoffeeRequired,DelayedGaming
    Supported Minecraft Versions:
    • 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19
    upload_2023-3-26_13-51-55.png

    This addon uses Google Json (Gson) API to work with Json in Skript, allowing users to edit Json files or even directly Variables that contain json.
    Discord: https://discord.gg/trwWpUkmQp

    Requirements

    • Java 17+
    • Minecraft 1.16.5+
    • Skript 2.6.4+
    Recommended

    ✨ Features

    JsonWatcher


    If the file changes, your json loaded in memory changes.

    Code (Text):
    1. on load:
    2.     link json file "plugins/raw/raw.json" as "test"
    3.     make jsonwatcher listen to "test"
    4.  
    5. command listenedJson:
    6.     trigger:
    7.         send cached json "test"
    JsonRequest (POST|GET)


    skJson can report POST/GET requests.


    1. execute GET request to "https://dog.ceo/api/breeds/image/random Fetch!" with headers '{"json-encode+": "true"}'
    2. execute POST request to "https://dog.ceo/api/breeds/image/random Fetch!" with headers '{"json-encode+": "true"}' and with body '{"user": "%player%"}'
    3. set {_body} to request's body[/backcolor][/font]
    Json Parser

    Objects obtained from json will be automatically parsed.

    Input: set {_json} to json from location(0,0,1, world "world")

    Code (Text):
    1. {
    2.     "==": "org.bukkit.Location",
    3.     "world": "world",
    4.     "x":0.0,
    5.     "y":0.0,
    6.     "z":1.0,
    7.     "pitch":0.0,
    8.     "yaw":0.0
    9. }
    Output: x: 0, y: 0, z: 1, yaw: 0, pitch: 0 in 'world'

    Json Changer


    ➕ ADD

    Using add you will be able to add values only to the json sheet. Here is an example of the syntax: add player's location to json list "pathxys" in {_json}

    ✔ SET

    With set you will be able to add values to json object or to set, here is an example of syntax set json value "test:A" in {_json} to diamond sword, While A is the value of the key, so always the last element in the string is the definition of the key.

    ➖ REMOVE

    Using remove you will be able to remove using key or using values or using the defined index of the JsonArray case. Here are some example syntax:


    1. remove diamond sword from {_json}
    2. remove player's location from json list "pathxys" in {_json}
    3. remove "hello" from keys of json object "pathxys" in {_json}
    4. remove diamond sword from values of json object "pathxys" in {_json}

Recent Reviews

  1. ExCorde
    ExCorde
    5/5,
    Version: 2.7,0
    Really good support! The author is very polite and professional. I love the idea and efficiency of this addon. Bugs get fixed very fast.