• 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!

AllJsonInFolder
Code:
on script load:
    send all json files in dir "./plugins/Skript/JSONS"

    loop all json files in dir "./plugins/Skript/JSONS":
        send loop-file
        send json from file loop-file

that will allowed to you, loop through directory and get the path of the given file and also the json from it.

Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.9.6...2.9.7
we changed from using NBT-Items to SKBee because Nbt was not working properly.

What's Changed
* Fix nbt using skbee by @cooffeeRequired in https://github.com/SkJsonTeam/skJson/pull/81


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.9.4...2.9.6
Fixing some small issues, non-async request was fixed.
Requests
This release fixes a serious bug in requests and webhooks that asynchronous startup did not work and blocked the main thread...
! It has also been removed for now on complete until I find out exactly why it blocked the main thread as well
Code:
on load:
    make new GET request to "https://dummyjson.com/products/2" and store it in {_data}:
       content: {_content}
       status code: {_code}
    execute {_data} and wait
    send {_content}
When you can create and save your request. and for example use Script-reflect to further work with it or directly in the section you can specify where to save it. The section is imspired by Skript-reflect!
Webhook
added for discord username and avatar-url

What's Changed
* Async await requests by @SkJsonTeam in https://github.com/SkJsonTeam/skJson/pull/76
* Update skjson.json by @SkJsonTeam in https://github.com/SkJsonTeam/skJson/pull/77


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.9.3...2.9.4
Working with Json within a literal has been added,
as well as improved asynchronous processing for the Request class.
Example of Request

If there is a return in on complete then skjson will recognize that you want to wait for a response, RECOMMENDATION: use this only when you know the server is available.
also in on complete you can execute any code because this section is so called executable

Code:
function test(i: number) :: object:
    async make POST request to "http://localhost:3000/?id=%{_id}%":
        save incorrect response: true
        lenient: true
        save:
            content: {_content}
        on complete:
            return {_content}
local function clear():
    loop 100 times:
        send " " to console

command test <number>:
    trigger:
        loop arg-1 times:
            wait 1 tick
            set {_t} to test(loop-number)
            send {_t}

Literal JSON
you don't need to use % before and after the expresseme because SkJson parser recognizes it and passes it to the Script parser. the same goes for strings, if you want to escape use classic json escape for example `\", \r, \t, \n"
Code:
on script load:
    set {_X} to @{"json": true}
    set {[i]json} to @{id: 10, something: "Test", var: {[/i]X}, string: "\nthis \"new\" Thing"}
    send {_json}

You must enable both of these features in the settings.

Config
Code:
  # Beta features
  features:
    # That feature will you allow use tld. literal string for e.g.
    # @{userId: 1, products: [{id: {[i]i}, quantity: 1}, {id: {[/i]j}, quantity: 2}]}
    # Inside the Literal string you don't need use a % for evaluate variables or expressions.
    # Also,you don't need to use string escape as like "", you can basically json string escape for e.g.
    # @{test: "This is \"New\" String"}
    # So the literal start always with @ and then continue a with a JSON
    literal-parsing-single-line: true
    
    # This Feature allows you to immediately get the value from the async run of the request.
    # For e.g.
    # function test(i: number) :: object:
    #    async make POST request to "https://dummyjson.com/carts/add":
    #        headers: @{Content-Type: "Application/json"}
    #        headers: json from text "{Content-Type: 'application/json'}"
    #        content: json from text "{userId: 1, products: [{id: %{_i}%, quantity: 1}, {id: 50, quantity: 2}]}"
    #        save incorrect response: true
    #        lenient: true
    #        save:
    #            content: {_content}
    #        on complete:
    #            return {_content}
    #
    # command test <number>:
    #    trigger:
    #        send test(arg-1)
    force-async-return: true

What's Changed
* Main http handing by @cooffeeRequired in https://github.com/SkJsonTeam/skJson/pull/75


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.9.1...2.9.3
SkJson 2.9.1

Fixes

16:52 - 24.09
1. Pretty print
2. Command skJson about

Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.9...2.9.1
SkJson 2.9

It's finally here, we have finally seen a fully stable version of SkJson, i.e. version 2.9 which introduced SkJson in the biggest steam, A lot of changes have been made from the ground up.

We have created our own documentation page for SkJson, on this page we will be able to post thready where you can share your code https://www.skjson.xyz/snippests, we also have documentation for both versions with examples. The documentation is automatically updated! Let's get started on the changes!

Condition
* Json file exist
* Json file is cached
* Json file is listening
* Json has value/key
* Json is empty
* Type of json

Expressions
* Count value/key in the Json.
* Get cached json
* Get index of key/value in (ListObject)
* Literals
* Loops
* New Json
* Pretty print
* Size of json object/array
* Skript variable to Json
* Value of JSON

Effects
* Change json file contents
* Json (virtual) storage [lon-linked]
* Json to Skript variable list
* JsonWatcher - Start/Stop listening to file
* Link json file with defined cache
* New json file with/out content
* Save cached json to file
* Unlink or unload json file from cache
* Write content to json file
* link and load all json files from given folder

Events
* watcher[/i]save]Json watcher save

Sections
* Http requests (All methods includes)
* Webhooks (Discord/Web)

Functions
* b64 (Decoding from String to B64)
* skjson_getdelim]skjsongtdelim (Get your defined delimiter)

Types
* JSON
* JSON-WEBHOOK
* JSON-ENUM ( WEBREQUEST METHODS )

Changers
* JSON-ARRAY
* JSON-OBJECT


Resolved Issues.
* #69
* #65
* #64
* #63
* #62
* #61
* #60
* #59
* #58
* #45
* #41
* #39
* #38

Special thanks...
I would like to thank everyone who participated in testing and trying out all sorts of features, and especially I would like to thank those who reported all the bugs!

Thank again! (@MinecraftNight4, @yhdev7935, @ExCorde, @Nocky, @welormit, @Envizar, @RedstoneGamer54)



What's Changed
* Update main from 2.8.6 to 2.9 by @SkJsonTeam in https://github.com/SkJsonTeam/skJson/pull/70


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.8.6...2.9
SkJson 2.8 (latest 2.8.6) Legacy
This is legacy version fro Skript 2.6.3 +

We have created our own documentation page for SkJson, on this page we will be able to post thready where you can share your code https://www.skjson.xyz/snippests, we also have documentation for both versions with examples. The documentation is automatically updated! Let's get started on the changes!

Condition
* Json file exists
* Json file is cached
* Json file is empty
* Json file is listening
* Json has value/key
* Json is empty
* Type of json

Expressions

* All cached jsons
* Array or List formatted to JSON.
* Count of objects/phrases
* Elements/Values of the json
* Get cached json
* Get last response
* Json size of given Json
* New json
* Pretty json

Effects
* Execute a http request
* JsonWatcher - Start listening to file
* JsonWatcher - Stop listening to file
* Link json file with defined cache.
* Map json to skript list
* New json file
* Save cached json to file
* UnLink or Unload json file
* Write json file with contents
* change json file
* link and load all json files from given folder

Functions
* jsonfile

Types
* json element
* json file

Changers
* Default changer of skJson (SET/REMOVE/ADD)


Resolved Issues.
* #71
* #64
* #63
* #42
* #41
* #39
* #38
* #37
* #24
* #22
* #21
* #20
* #19
* So one...

Special thanks...
I would like to thank everyone who participated in testing and trying out all sorts of features, and especially I would like to thank those who reported all the bugs!

Thank again! (@MinecraftNight4, @yhdev7935, @ExCorde, @Nocky, @welormit, @Envizar, @RedstoneGamer54)

@!Legacy
SkJson 2.9

It's finally here, we have finally seen a fully stable version of SkJson, i.e. version 2.9 which introduced SkJson in the biggest steam, A lot of changes have been made from the ground up.

We have created our own documentation page for SkJson, on this page we will be able to post thready where you can share your code https://www.skjson.xyz/snippests, we also have documentation for both versions with examples. The documentation is automatically updated! Let's get started on the changes!

Condition
* Json file exist
* Json file is cached
* Json file is listening
* Json has value/key
* Json is empty
* Type of json

Expressions
* Count value/key in the Json.
* Get cached json
* Get index of key/value in (ListObject)
* Literals
* Loops
* New Json
* Pretty print
* Size of json object/array
* Skript variable to Json
* Value of JSON

Effects
* Change json file contents
* Json (virtual) storage [lon-linked]
* Json to Skript variable list
* JsonWatcher - Start/Stop listening to file
* Link json file with defined cache
* New json file with/out content
* Save cached json to file
* Unlink or unload json file from cache
* Write content to json file
* link and load all json files from given folder

Events
* watcher[/i]save]Json watcher save

Sections
* Http requests (All methods includes)
* Webhooks (Discord/Web)

Functions
* b64 (Decoding from String to B64)
* skjson_getdelim]skjsongtdelim (Get your defined delimiter)

Types
* JSON
* JSON-WEBHOOK
* JSON-ENUM ( WEBREQUEST METHODS )

Changers
* JSON-ARRAY
* JSON-OBJECT


Resolved Issues.
* #69
* #65
* #64
* #63
* #62
* #61
* #60
* #59
* #58
* #45
* #41
* #39
* #38

Special thanks...
I would like to thank everyone who participated in testing and trying out all sorts of features, and especially I would like to thank those who reported all the bugs!

Thank again! (@MinecraftNight4, @yhdev7935, @ExCorde, @Nocky, @welormit, @Envizar, @RedstoneGamer54)



What's Changed
* Update main from 2.8.6 to 2.9 by @SkJsonTeam in https://github.com/SkJsonTeam/skJson/pull/70


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.8.6...2.9
SkJson 2.9

It's finally here, we have finally seen a fully stable version of SkJson, i.e. version 2.9 which introduced SkJson in the biggest steam, A lot of changes have been made from the ground up.

We have created our own documentation page for SkJson, on this page we will be able to post thready where you can share your code Snippets, we also have documentation for both versions with examples. The documentation is automatically updated! Let's get started on the changes!

More here!