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

What's Changed
* Switch from json serializaton to custom adapters by @SkJsonTeam in https://github.com/SkJsonTeam/skJson/pull/85
* Switch from json serializaton to custom adapters by @cooffeeRequired in https://github.com/SkJsonTeam/skJson/pull/89


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/3.0.1...3.0.3


[!IMPORTANT]
## BugFixes
##### 1. Bug regarding bad encoding of ASCII characters https://github.com/SkJsonTeam/skJson/issues/88
Code:
[quote][/quote]local function ASCIISymbolsFix2[i]26[/i]24():
>	set {_json} to json from file "./plugins/Scripts/test.json"
>	send json from "»»»" to console
>	send {_json} with pretty print to console
[quote][/quote]
At this point the json file returned "B»B»B»" for some it was ~A"~A"~A"
This is already fixed.
>
##### 2. Bug regarding to completed resource handling for requests discord
Code:
[quote][/quote]local function requestSyncFix2[i]26[/i]24() :: object:
>	set {_request} to prepare new GET request on "https://raw.githubusercontent.com/SkJsonTeam/skJson/main/skjson.json"
>	set {_request}'s request content to @{"A": true}
>	set {_request}'s headers to @{"Content-Type": "application/json+vhd"}
>	sync send prepared {_request}
>
>	if response status of {_request} is "OK":
>		return response content of {_request}
[quote][/quote]
Fixed for now, working with web request is always meh, but if you really need to use synchronous request you can now use [:sync] (send|execute) [prepared] %request%
>
##### 3. Bug regarding to wrong parsing for value of %json% https://github.com/SkJsonTeam/skJson/issues/86
Now fully fixed
>
##### 4. Bug regarding to FileWriting https://github.com/SkJsonTeam/skJson/issues/84
Writing and formatting was handled by one method, which was not properly checked now fixed
>

[!NOTE]
Huge thanks to the guys who continue to diligently report bugs and test limits to the world of json - SkJson
@Envizar
@kubaczak
@ExCorde
@ImNotStable
@Pumkinhead
@MinecraftNight4
>
Big Shout Out to Them!
Fix broken save json %string% For example, the operations for linking a file were error, fix (save json "..."), that will handle in the newest Skript version as World.
Fix cache - cache will be keep until reload/restart your server



Full Changelog: https://github.com/SkJsonTeam/skJson/compare/3.0.1...3.0.2-IO
Change from Effect to AsyncEffect to process asynchronous operations exactly as expected. For example, the operations for linking a file were error

Full Changelog: https://github.com/SkJsonTeam/skJson/compare/3.0.0...3.0.1
Major updates to SkJson (breaking changes!)

Internal API has been changed for the latest version only Skript 2.8+ is supported, also requests have been changed, now they are more skript friendly from
Code:
on script load:
    async make POST request to "https://dummyjson.com/carts/add":
        headers: "Content-Type: application/json"
        content: json from text "{userId: 1, products: [{id: 1, quantity: 1}, {id: 50, [quote][/quote]quantity: 2}]}"
        save incorrect response: true
        lenient: true
        save:
            content: {-content}
            headers: {-header}
            status code: {-code}
            url: {-url}
At @Requests
Code:
    set {_request} to prepare new GET request on "https://raw.githubusercontent.com/SkJsonTeam/skJson/main/skjson.jsonn"
    set {_request}'s request content to @{"A": true}
    set {_request}'s headers to @{"Content-Type": "application/json+vhd"}
    send prepared {_request}

    if response status is "OK":
        send response status code of {_request}
        send response content of {_request}
        send response status code of {_request}
        send response headers of {_request}
webhooks will be updated in future versions..
Supplied
- https://skjson.xyz/documentation/latest#expression-IndexListObject
- https://skjson.xyz/documentation/latest#expression-AllJsonInFolder

Modified algorithm for parsing a string to a Key Structure. Faster file processing. Fixed working with files.. now files are locked only if really used.

Finished single line literal json.

What's Changed
* 3.0.0 pre by @SkJsonTeam in https://github.com/SkJsonTeam/skJson/pull/83


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.9.7...3.0.0
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