skJson by CoffeeRequired

Working with json in skript

Events

1

Expressions

14

Effects

11

Conditions

6

Types

2

Sections

2

Structures

0

Total

36

Fix nbt issues, add ~ as path identifier 52 days, 7 hours and 7 minutes ago

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/3.0.6...3.0.7

[!IMPORTANT]
## BugFixes
##### 1. Bug regarding bad parsing of nbt https://github.com/cooffeeRequired/skJson/issues/90
command /addtrade:
permission: OP
trigger:
set {_jt} to json from file "plugins/SkJson/test.json" # this is my json file
set {_slot0} to full nbt compound of slot 0 of player
set {_slot1} to full nbt compound of slot 1 of player
set {_slot2} to full nbt compound of slot 2 of player
set {_n} to 0
>
send {_jt} with pretty print to console
>
write {_jt} to json file "plugins/SkJson/trader.json"
loop values "trade::%{n}%" of {jt}:
send json-key to console
set value of json object "trade::0::%{n}%::0::nbt" in {jt} to {_slot0}
set value of json object "trade::0::%{n}%::1::nbt" in {jt} to {_slot1}
set value of json object "trade::0::%{n}%::2::nbt" in {jt} to {_slot2}
write {_jt} to json file "plugins/SkJson/trader.json"

>
At this point the nbt are converted successfully to the Object
"nbt": {
"..": "com.shanebeestudios.skbee.api.nbt.NBTContainer",
"nbt": "{Count:1b,id:\"minecraft:stone\",tag:{CustomModelData:222,Damage:222,Enchantments:[{id:\"aquaaffinity\",lvl:1},{id:\"bindingcurse\",lvl:1},{id:\"vanishing_curse\",lvl:1}],RepairCost:2222,Tags:[\"Test\",\" test2\",\" test\"],display:{Lore:['[{\"text\":\"asdasdasdasd\",\"italic\":false}]'],Name:'[{\"text\":\"asdasdasd\",\"italic\":false}]'}}}"
}


##### 2. Bug regarding to wrong parsed http headers
Sometime could happen the Content-Type headers was broken, missing space or basically sending body to the GET request
That is already fixed, all headers could be used no matter what.
>
##### 3. Bug regarding to response types (JsonArray or Plain/Text)
The response of type JsonArray or Plain/Text was ignored, that's already fixed and sanitized!


[!NOTE]
## Add
##### ~ as path identifier of plugins/Skript/scripts
#### Example
on load:
set {_file} to json from file "~/test.json"
new json file "~/raw.json"
send {_file}

>
So the file will be created in the plugins/Skript/scripts

[!NOTE]
Huge thanks to the guys who continue to diligently report bugs and test limits to the world of json - SkJson
@PEX666
@kubaczak
@Boxic
@kitoxis
@DRAGNIL68
>
Big Shout Out to Them!

View Update

3.0.6 53 days, 2 hours and 52 minutes ago

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/3.0.5...3.0.6

[!IMPORTANT]
Fix reading json arrays from web requests.

View Update

3.0.5 60 days, 22 hours and 39 minutes ago

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/3.0.4...3.0.5

[!IMPORTANT]
Fix permission escalation for skjson command, now you need to have permission node skjson.use or op

View Update

Fix editing files, request on authorized website, fix patch request 61 days, 8 hours and 36 minutes ago

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/3.0.3...3.0.4

[!IMPORTANT]
## BugFixes
### 1. Bug regarding on editing files. with effect edit
>
command changefile:
> trigger:
> edit value "type" of json file "plugins/Skript/scripts/test.json" to "DIAMOND"
`

###### Before
changefile
[08:28:42 INFO]: [SkJson] WARN Cannot create a file plugins/Skript/scripts/test.json cause the file already exists.


#### 2. Bug regarding on sending web request on authorized apis (google, icloud, crypto stuff, and more)

View Update

Fix Some small issues and typos 73 days, 14 hours and 32 minutes ago

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
local function ASCIISymbolsFix22624():
> set {_json} to json from file "./plugins/Scripts/test.json"
> send json from "»»»" to console
> send {_json} with pretty print to console

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
local function requestSyncFix22624() :: 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}

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!

View Update

3.0.2-IO 111 days, 16 hours and 24 minutes ago

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

View Update

Fix async save/load cache and add Sync for requests 111 days, 20 hours and 44 minutes ago

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

View Update

Major SkJson Update (Breaking changes!) 117 days, 18 hours and 45 minutes ago

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

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,
quantity: 2}]}"
save incorrect response: true
lenient: true
save:
content: {-content}
headers: {-header}
status code: {-code}
url: {-url}

At @Requests
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

View Update

new expression for handling files in the directory. 131 days, 18 hours and 43 minutes ago

AllJsonInFolder

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

View Update

From NBT-ITems to SkBee NBT 147 days, 17 hours and 39 minutes ago

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

View Update

2.9.5 Fix requests 158 days, 18 hours and 37 minutes ago

Fixing some small issues, non-async request was fixed.

View Update

Fixed Requests | Webhooks 192 days, 20 hours and 2 minutes ago

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

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

View Update

Async-await-request, Literal Json String 204 days, 2 hours and 41 minutes ago

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

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"
on script load:
set {_X} to @{"json": true}
set {json} to @{id: 10, something: "Test", var: {X}, string: "\nthis \"new\" Thing"}
send {_json}


You must enable both of these features in the settings.

Config
# Beta features
features:
# That feature will you allow use tld. literal string for e.g.
# @{userId: 1, products: [{id: {i}, quantity: 1}, {id: {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

View Update

SkJson 2.9.1 228 days and 23 minutes ago

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

View Update

SkJson 2.9 235 days, 18 hours and 50 minutes ago

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[s][/s][s]
* Json is empty
* Type of json

Expressions
* Count value/key[s] in the Json.[/s][s]
* 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[s] of JSON[/s][s]

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
* [url=https://skjson.xyz/documentation/beta#event-jsonwatchersave]Json watcher save[/url]

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

Functions
* b64 (Decoding from String to B64)
* [url=https://skjson.xyz/documentation/beta#function-function[/i]skjson_getdelim]skjsongtdelim (Get your defined delimiter)[/url]

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
[/s][/s][/s]

View Update

SkJson legacy 235 days, 18 hours and 51 minutes ago

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

View Update

SkJson 2.9 237 days, 16 hours and 15 minutes ago

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[s][/s][s]
* Json is empty
* Type of json

Expressions
* Count value/key[s] in the Json.[/s][s]
* 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[s] of JSON[/s][s]

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
* [url=https://skjson.xyz/documentation/beta#event-jsonwatchersave]Json watcher save[/url]

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

Functions
* b64 (Decoding from String to B64)
* [url=https://skjson.xyz/documentation/beta#function-function[/i]skjson_getdelim]skjsongtdelim (Get your defined delimiter)[/url]

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
[/s][/s][/s]

View Update

SkJson 2.0 237 days, 16 hours and 29 minutes ago

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!
https://github.com/SkJsonTeam/skJson/releases/tag/2.9

View Update

SkJson 2.8.6 317 days, 23 hours and 8 minutes ago

SkJson 2.8.6
Fixed several issue with Paper/Purpur and skript 2.7.0 beta.
Fixed nulls elements by (SET/ADD) new element to JsonArray/JsonObject
Add loading json files from folder to the cache
https://github.com/SkJsonTeam/skJson/releases/tag/2.8.6

View Update

SkJson 2.8.5 - Fixed java issues and file writing 358 days, 23 hours and 56 minutes ago

SkJson 2.8.5
[h4]Fixed java issue and file writing[/h4]
[h3]Minecraft support:[/h3]
- 1.13 - 1.16.5,
- 1.16.5-1.20

[h3]Skript version: [/h3]
- 2.7.0 - Beta 1,
- 2.7.0 - Beta 2,
- 2.6.4

What's Changed
Update Reflection.java by @cooffeeRequired in https://github.com/SkJsonTeam/skJson/pull/50


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.8.4...2.8.5


Thank everyone for their support for ideas
Sincerely coffeeRequred.

View Update

Small fixes 378 days, 18 hours and 30 minutes ago

SkJson 2.8.3

Doc's updated (SkUnity, SkriptHub)
Skript version:

  • 2.7.0 - Beta 1,
  • 2.7.0 - Beta 2,
  • 2.6.4

Changed
  • small changes was also in the Execute web request




(execute|send|make) [new] (<.+>|%-string%) request to %string% [(:with headers) %-strings/json%] [and with (:body|:data) %-strings/json%]

(execute|send|make) [new] (<.+>|%-string%) request to %string% [with (:body|:data) %-strings/json%] [and (:with headers) %-strings/json%]
[/code]


Fixed

  • size of %json% -> json size of %json%, cause old syntax has conflict with vanilla skript
  • fixed block thread in the async method for sending request's and wriiting to file

Added
  • Added convertation from .yml files to .json


set {_yaml json} to json from yaml file "..../test.yaml"

[/code]

  • more properties of request's responses


[SkJson] [(:current|:previous)] request's (2:body|3:code|4:connection headers|[user] (5:headers)|6:url)

[skJson] (2:body|3:code|4:connection headers|[user] (5:headers)|6:url) of [(:current|:previous)] request
[/code]







What's Changed


Full Changelog: https://github.com/SkJsonTeam/skJson/compare/2.8.2...2.8.3

Thank everyone for their support for ideas
Sincerely coffeeRequred.


View Update

Small fixes 394 days and 47 minutes ago

SkJson - 2.8.2 Small Fixes

Updated examples,

Added examples for JsonChanger,
Also Using @NoDoc for Expression which are only auxiliary,
Also fixed bug which caused that longer strings were not saved to cached json..
Also modified debug system. https://github.com/cooffeeRequired/skJson/releases/tag/2.8.2

View Update

Big Changes! [Potencialy break Skripts] 410 days, 6 hours and 12 minutes ago

A lot of changes have been made, practically the whole addon is redesigned for performance reasons, some features are added but please read more on Github



Thanks CoffeeRequired!

View Update

Bug fixing ItemStack, CustomModelData, Encoding, Performance, CleanUP 441 days, 22 hours and 47 minutes ago

skJson 2.7.0⚠️
Introduce


Hello everyone.

- Fix small bugs
- Fixed bundles
- Cleanup code
- fix Typos


[h3]Example[/h3]

{
"items": [
{"==":"org.bukkit.inventory.ItemStack","v":3218,"type":"APPLE","meta":{"==":"ItemMeta","meta-type":"UNSPECIFIC","display-name":"{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Tomate\"}],\"text\":\"\"}","custom-model-data":1}},
{"==":"org.bukkit.inventory.ItemStack","v":3218,"type":"APPLE","meta":{"==":"ItemMeta","meta-type":"UNSPECIFIC","display-name":"{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Tomate2\"}],\"text\":\"\"}","custom-model-data":1}},
{"==":"org.bukkit.inventory.ItemStack","v":3218,"type":"APPLE","meta":{"==":"ItemMeta","meta-type":"UNSPECIFIC","display-name":"{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Tomate3\"}],\"text\":\"\"}","custom-model-data":1}}

],
"nums": [
1,
2,
3,
0
]
}

command try:
trigger:
set {_} to json from file "items/test.json"
send {_}
remove json object player's tool from nested object "items" of {_}
remove json index 1 from nested object "nums" of {_}
send {_} with pretty print
````
* Fixed olders issue contains invalid mapping or invalid converting to the json.
* Also fixed issue what should remove the meta from the ItemStack, which should not be removed.
* Also fixed issue with CustomModelData contains id of model was lost from converting to json.
* Path-Hotlinking will not added because it's necessary use that hotlink instead link file instead.
* #13 null as new Data (Bug) was fully fixed -> Will apear error when you tried converting null json to the object.
* #15 fully supported new syntax for remove json from nested object.
* #18 - Item Conversion. When you put item to the Skript list and then you want retrieve it as json form, you got broken json from BukkitSerilization instead of our json normal representation
* #19 UTF-8 encoding error, Fixed
* #20 Item-Data encoding error, Fixed
* #24 Bundle(Custom model Data) lost, Fixed (Minecraft 1.19+)


PLEASE READ THE NEW SYNTAXE'S! on the Skript hub



Please check SkriptHub or Wikipedia for syntax changes.
## ❌ If you found any bugs, feel free to post it.

Sincerely, Coffee.

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/2.6.0...2.7.0

View Update

pre-release skJson 2.7.0 446 days, 5 hours and 39 minutes ago

skJson pre-release 2.7.0⚠️
Introduce

> Hello everyone.

- Fix small bugs #22 #21 #20
- Fixed bundles
- Cleanup code
- fix Typos


[h3]Example[/h3]

{
"items": [
{"==":"org.bukkit.inventory.ItemStack","v":3218,"type":"APPLE","meta":{"==":"ItemMeta","meta-type":"UNSPECIFIC","display-name":"{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Tomate\"}],\"text\":\"\"}","custom-model-data":1}},
{"==":"org.bukkit.inventory.ItemStack","v":3218,"type":"APPLE","meta":{"==":"ItemMeta","meta-type":"UNSPECIFIC","display-name":"{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Tomate2\"}],\"text\":\"\"}","custom-model-data":1}},
{"==":"org.bukkit.inventory.ItemStack","v":3218,"type":"APPLE","meta":{"==":"ItemMeta","meta-type":"UNSPECIFIC","display-name":"{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Tomate3\"}],\"text\":\"\"}","custom-model-data":1}}

],
"nums": [
1,
2,
3,
0
]
}

```vb
command try:
trigger:
set {_} to json from file "items/test.json"
send {_}
remove json object player's tool from nested object "items" of {_}
remove json index 1 from nested object "nums" of {_}
send {_} with pretty print
````
Please check SkriptHub or Wikipedia for syntax changes.
❌ If you found any bugs, feel free to post it.

Sincerely, Coffee.

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/2.6.21...pre-release-2.7.0

View Update

Item Conversion in JSON (Form of Skript list) Supported! 463 days, 5 hours and 15 minutes ago

skJson 2.6.21⚠️
Introduce
Hello everyone.

New conventors for json.

  • Fix small bugs, #18
  • Cleanup code
  • fix Typos

Fixed.

command try:
trigger:
set {_test::*} to diamond sword named "&aA", apple, stone pickaxe
broadcast {_test::*}'s form with pretty print

set {_test::item1} to diamond sword named "&aA"
set {_test::item2} to stone pickaxe
set {_test::item3} to apple

broadcast {_test::*}'s form with pretty print
on load:
execute console command "try"


Please check SkriptHub or Wikipedia for syntax changes.

❌ If you found any bugs, feel free to post it.
Sincerely, Coffee.

Full Changelog: 2.6.2...2.6.21

View Update

Updated 2.6.2 465 days, 23 hours and 14 minutes ago

->

View Update

skJson 2.6.2 Support java 11, Automatic parsing 470 days and 52 minutes ago

skJson 2.6.2⚠️
Introduce


Hello everyone.

- New conventors for json.
- Adding automatic parsing.
- Cleanup code
- fix Typos


From

command test:
trigger:
set {_loc-json} to json from player's location
set {_loc} to {_loc-json} parsed as a location
teleport player to {_loc}

To
command test:
trigger:
set {_loc-json} to json from player's location
teleport player to {_loc-json}


Please check SkriptHub or Wikipedia for syntax changes.
❌ If you found any bugs, feel free to post it.


Sincerely, Coffee.

What's Changed
* New Conventors by @cooffeeRequired in https://github.com/cooffeeRequired/skJson/pull/14

Full Changelog https://github.com/cooffeeRequired/skJson/compare/2.6.1...2.6.2

View Update

skJson (Mapping/Appending) 2.6.1 472 days, 14 hours and 46 minutes ago

skJson 2.6.1⚠️
Introduce

Hello everyone.
Hotfixed issue #11 , also the #13
Also was fixed all mapping / append / write issues.


Please check SkriptHub or Wikipedia for syntax changes.
## ❌ If you found any bugs, feel free to post it.

Sincerely, Coffee.

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/2.5.9...2.6.1

View Update

skJson 2.5.9 474 days, 3 hours and 8 minutes ago

skJson 2.5.9 ⚠️

Introduce

Hello everyone.
Fixed changers, for json you are now able to remove/add or set objects even with cached json.
Added removing/setting for nested objects

This error was related to this thread #8


Version 2.5.9
Example


on load:
set {_json} to json from string "{'A': [1,2,3,4,{'B':false}]}"
set json value "A[1]" of {_json} to true

# Before {"A":[1,2,3,4,{"B":false}]}

remove json value "A[4]:B" from {_json}
add values 1,2,3,4 to {_json}
send {_json}

# After {"A":[1,2,3,4,{}]}

load json file "try3.json" as "try"
send cached json "try"
set json value "A[0]" of cached json "try" to true
send cached json "try"


Please check SkriptHub or Wikipedia for syntax changes.
❌ If you found any bugs, feel free to post it.

Sincerely, Coffee.

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/2.5...2.5.9

View Update

skJson 2.5 475 days and 2 hours ago

skJson 2.5 ⚠️
Introduce


Hello everyone.
This is a big milestone for skJson addon (*skript-gson*)
One of the first pieces of information is that it has been renamed from the current skript-gson to skJson. I renamed this addon because the gson in the name said little to anyone and was not as representative. thus skJson contains both json in the word and Skript (sk)

I should also mention that support for older versions of minecraft server has been added. Since version 1.8.8 this addon is able to work.

I must also mention that the kernels for file handling and json serialization have been redesigned. For example, you can now serialize nbt and or entities.

A lot of syntax has been modified and simplified. one of my favorites is the Append effect, here is an example

append player's tool with key uuid of player as nested object "data:players tools[1]" to json file "..."

Don't worry I'll show you everything here, the new syntax is more intiative and I hope you'll find it easier to work with this addon, at the moment the addon supports around 24/25 data-types, if you want to add some that isn't just create a github thread as suggestion and I'll be happy to take a look.

I would also like to thank the total number of support and downloads for this addon and that is 4129x to date.

Alright let's get on with the news.

News
[h3]Adapters ⏺️[/h3]
NBT, Entity, Chunk, ItemStack, World, Inventory, bukkit-types, and some Skript-types.

Please check SkriptHub or Wikipedia for syntax changes.

Sincerely, Coffee.

Full Changelog: https://github.com/cooffeeRequired/skJson/compare/2.1.1...2.5

View Update

Updated AutoUpdaters. Skript-gson 2.1.0 492 days and 1 hour ago

Hello everyone

Hi there we have a couple of changes regarding the new json from the request, also changes in the Versioning Area and its automatic updates.

Thank you all for your attention.
Sincerely Coffee.

Full Changelog: [URL='https://forums.skunity.com/http:/#%20skript-gson%202.0.4%20%F0%9F%94%B0%20![Git](https://user-images.githubusercontent.com/106232282/200513198-968073f2-8249-4c40-b161-e81ac7a92f99.png)%20-%20##%20**Hello%20everyone%20%F0%9F%91%8B**%20Hi%20there%20we%20have%20a%20couple%20of%20changes%20regarding%20the%20new%20json%20from%20the%20request,%20also%20changes%20in%20the%20Versioning%20Area%20and%20its%20automatic%20updates.%20%20Thank%20you%20all%20for%20your%20attention.%20\%20Sincerely%20Coffee.%20%F0%9F%91%8B%20%20**FTW**%20*skript-gson*%20%20**Full%20Changelog**:%20https://github.com/cooffeeRequired/skript-gson/compare/2.0.4...2.1.0']https://github.com/cooffeeRequired/skript-gson/compare/2.0.4...2.1.0[/URL]

View Update

skript-gson 2.0.4 - Changed internal object mapping 493 days, 1 hour and 1 minute ago





Hello everyone
Changed internal object mapping for Items, now you are able to pull Item from mapped json as well


command saveinv:
trigger:
set {inv} to json from player's inventory

command listinv:
trigger:
map {inv} to {_inv::*}
loop (indices of {_inv::contents::*}):
if {_inv::contents::%loop-value%::*} is set:
set {_item} to {_inv::contents::%loop-value%::*}'s form parsed as skript-type
give {_item} to "player's name" parsed as player

[/code]




[/FONT]

View Update

skript-gson 2.0.3 503 days, 4 hours and 55 minutes ago








View Update

skript-gson 2.0.2 508 days, 3 hours and 26 minutes ago

added - all json elements from %jsonelement%

View Update

skript-gson 2.0.2 508 days, 13 hours and 46 minutes ago









set {_json} to new json from string "{'A': {}, 'B': [], 'C': {'G': {}}}"
add false to {_json} # example 1
add "A:test;false" to {_json} # example 2
add "C:G:test;A" to {_json} # example 3

# Show case 1
{"A": {}, "B": [], "C": {"G": {}}, "3": false}
# Show case 2
{"A": {"test": false}, "B": [], "C": {"G": {}}}
# Show case 3
{"A": {}, "B": [], "C": {"G": {"test": "A"}}}





View Update

skript-gson 2.0.0 512 days, 16 hours and 39 minutes ago

New release of skript-gson it's out. 2.0.0 Fixed all known mapping bugs, also added SkriptTypes and Bukkit type conversion, also Inventory. Changed functionality and loaded Json as a custom ID, etc. https://skripthub.net/docs/?addon=skript-gson https://github.com/cooffeeRequired/skript-gson/releases/tag/2.0.0

View Update

skript-gson 1.4.0 (Loading file as given ID) 521 days, 20 hours and 31 minutes ago





View Update

skript-gson 1.3.3 - small fix 523 days, 9 hours and 1 minute ago

  • Fixed writing to file.

View Update

Fixed version skript-gson 525 days, 20 hours and 5 minutes ago

View Update

Skript-Gson 1.3.1 532 days, 4 hours and 36 minutes ago


  • Fixed docs on GitBook.


  • Fixed version of Skript-Gson, which is now free of dangerous bugs. Json Mapping fix
  • Feature 'with variables'
  • Feature ~%object% -> JsonKeys for Changer

View Update

Skript-gson 1.3.0 updated 535 days, 3 hours and 42 minutes ago

View Update

Skript-Gson 1.2.0 546 days and 5 minutes ago

https://github.com/cooffeeRequired/skript-gson/releases

Skript-Gson 1.2.0

Hello everyone
This patch won't please some of you, mainly because after reaching the 50th download milestone we noticed that few people know how Non-Literal Json means

json ...
works.

So we decided to remove this feature and work on improvements in putting and adding to the Json file/variable.
The last version is rather a mess and so this version will be cleaned of all necessities plus the examples will be corrected so that the layman can understand them

Format
Finished:
ExprNewJson.class

[a] [new] json from [(text|string|request)] %object%

Removed:
Non-Literal from ExprNewJson.class

Added: serialization\deserialization for
ItemTypes,BlockData
etc.. More here

Expressions
Finished:
ExprJsonListToJsonElement.class
-> Fixed working with objects, now you can change the whole variable.
Added:
ExprCountOfJson.class

[a] count of [key] %string% in %jsonelement%

Added:
ExprJsonRegexMatch.class

[json] %jsonelement% [regex] match[es] %string%

♾️ Change/Fix:
ExprLoadJsonFile.class
-> At this moment i cannot guarantee the syntax

Effects
♾️ Planed:
EffHandleJsonFile.class

load json file %string% as id %string%
unload json file [id] %string%
save json file [id] %string%

♾️ Planed-Rework:
EffMapJsonToList.class
-> will contains new feature.
♾️ Planed-Rework:
EffWriteToFile.class
-> will contains new feature.

Conditions
Added:
CondJsonHas.class

%jsonelement% has (:key|:value) %objects%
%jsonelement% has list (:keys|:values) %objects%

♾️ Planed-Rework:
CondJsonValueObject.class

[a] value %string% in %jsonelement% is (:true|:false)
[a] value %string% in %jsonelement% is string
[a] value %string% in %jsonelement% is integer
[a] value %string% in %jsonelement% is boolean
[a] value %string% in %jsonelement% can be parsed

Thank you all for your attention. \
Sincerely Coffee.

FTW *Skript-Gson*
*

View Update

Skript-Gson 1.1.3 - Sanitize Patch. 549 days, 17 hours and 59 minutes ago



Hello everyone

This patch fixes bugs #1, #2
and also fixes a syntax error where you couldn't use variables for example in

'append.. '


Change from
...

"[a] [new] json from (string|text) %string%",
"[a] [new] json from file [path] %string%",
"json (([<.+>])|({<.+>}))",
"(<'.+'>)"

...

On \

...

"[a] [new] json from (string|text) %string%",
"[a] [new] json from file [path] %string%",
"(json ((<\\[.*\\]>)|(<\\{.*\\}>)|((\\\"|')<.+>(\\\"|'))|(<(true|false)>)))"

...

[h3]Also added a new substring \[/h3]
[a] json file %object% is exist

View Update

Updated Skript-Gson 550 days, 1 hour and 23 minutes ago

https://github.com/cooffeeRequired/skript-gson/releases/tag/1.1.0

View Update

Skript-Gson 550 days, 5 hours and 40 minutes ago

Skript-Gson 1.1.0

This this realese brings new features such as.
Expressions


  • (load|open)[ed] json file %string%


Effects

  • write [new] data %jsonelement% to [json] file %object%


  • append(ing|) [new] data %jsonelement% to [json] file %object% [(:as) [nested] object %-jsonelement% [(:with) [property] key %-string/integer%]]


Full Changelog: https://github.com/cooffeeRequired/skript-gson/compare/1.0.2-Beta...1.1.0

View Update

Added new syntax for Add 555 days, 5 hours and 20 minutes ago

Check out : https://skripthub.net/docs/?id=8183

View Update

skJson 555 days, 16 hours and 15 minutes ago



















on script load:
# From String
# We can use escape sequences so two double quotes, or we can use single quote
# Or we can define only KEYS without any quotes
set {_json} to json from text "{""A"": false}"
set {_json} to json from text "{'A': false}"
set {_json} to json from text "{A: false}"

# From file (json/yaml)
# YAML: you can your old yaml file and SkJson will convert that to JSON file
set {_json} to json from json file "plugins/SkJson/Files/test.json"
set {_json} to json from yaml file "plugins/SkJson/Files/test.yaml"

# From website
# That will work only for GET! If you want to use other methods you should use requests
set {_json} to json from website "https://dummyjson.com/products/1"

# From any Skript/Bukkit object
set {_json} to json from location(10, 20, 30, world("world"))



on script load:
async make POST request to "https://dummyjson.com/carts/add":
header: "Content-Type: application/json"
content: json from text "{userId: 1, products: [{id: 1, quantity: 1}, {id: 50, quantity: 2}]}"
save incorrect response: true
lenient: true
save:
content: {-content}
headers: {-header}
status code: {-code}
url: {-url}
command response:
trigger:
send {-content} with pretty print



# here we will create a new file
options:
file_path: "plugins/SkJson/jsons/test.json"

on script load:
new json file {@file_path} if json file {@file_path} does not exist

# here we will work with the json file

set {_json} to json from file {@file_path}

# writing to file
set {_data} to json from location(10, 20, 30, world("world"))
write {_data} to json file {@file_path}

# editing directly file
edit value "world" of json file {@file_path} to "New World"

# editing file with step over

# getting the json file as Json object
set {_json} to json from file {@file_path}
set value of json object "world" in {_json} to "New World(By rewrote)"

# write file back to JSON
write {_json} to json file {@file_path}



options:
file_path: "plugins/SkJson/jsons/test.json"

on script load:
# here we will create a new file
new json file {@file_path} if json file {@file_path} does not exist
# here we will linked our file to our memory.
link json file {@file_path} as "your_specified_value" if json file {@file_path} exists

# here we will set value to memory reference of your file.
set value of json objct "location" in (json "your_specified_value") to location(10, 20, 30, world("world"))

# here we will get location of memory
set {_location} to value "location" of (json "your_specified_value")
# that will return {"==":"org.bukkit.Location","yaw":0.0,"world":"world","x":10.0,"y":20.0,"z":30.0,"pitch":0.0}

# here we will save memory reference back to file
save json "your_specified_value"



# let's say we have a command test and we work with Player Location.
command test:
trigger:
set {_json_location} to json from location of player
teleport player to {_json_location}
# that will teleport player to location converted from JSON object to location

set {_item} to diamond sword named "Test"
set lore of {_item} to "&6Gold" and "&7Silver"
enchant {_item} with Sharpness 5
set {_json_item} to json from {_item}

give {_json_item} to player

View Update

© Copyright 2014-2024 skUnity

All rights reserved.