#Learning SkJson

1 messages · Page 1 of 1 (latest)

shy mulch
#

So im trying to learn SkJson to be able to get data out of json files but i have no clue where to get started. I am looking at the documentation and understand 0 of what im looking at. If someone could help me with syntax like how to load in the json file aswell as pulling specific things like "Author" or "Description"

#

please ping me when responding

queen hedge
#

you can do something like set {_hi} to json from file "..."

#

and edit value "data[0]::username" of json file "/plugins/Script/Jsons/test.json" to >"Jakub"

#

You can get individual values of the json with set {_loc} to value "Location" of {_json}

#

I might be wrong about this one but you can probably get individual values directly like this: value "data[0]::username" of json file "/plugins/Script/Jsons/test.json"

shy mulch
#

Sorry for being inexperienced but how does “data[0]::username” work like what part of the Json file would that find

{
username: “test”
}

This? ^^

#

@queen hedge

sand river
#

the [] represent an array

#

where is array in your example?

#
{"data": [{"username": "Bontoos"}]}
#

an array

#
{"username": "Bontoo"}
#

without arry

shy mulch
#

I don’t really understand how this all works sorry for wasting peoples time but I just can’t connect the dots in my brain. Would the things you sent be the json file and data is like the category in it and username is the data I want to access or what

sand river
#

Ahh I see

#

Do you even know how works an json?

shy mulch
mellow ermine
#

plus skript-yaml is easy to use

shy mulch
#

would you be able to go through the basics like how to access the file, The specific content etc. Thanks btw

sand river
#

Did you read the GitHub docs

shy mulch
#

For SkJson or Skript-yaml?

sand river
#

Skjson

shy mulch
#

I did read through it but im guessing due to my lack of knowledge i didnt undestand anything

shy mulch
#

So i sorta figured out skript-yaml. Only thing im sort of not sure about is how the reading is being done as all the examples ive found theres no example showing the actuall yaml file.

set yaml value "%player%.location"``` would this change player.location as in this example yaml file


```yaml

player.location: "this"
#

except the actual player's name

mellow ermine
#

from "config" is the location of the yaml file

mellow ermine
shy mulch
#

so "config" will automatically be the loaded yaml file or do i have to load yaml file "" as config?

sand river