Creating
Official docs of Skript-gson
Examples of json creating
Getting json from a file
options:
    storage: json from file "plugins/YourAwesome/storage.json"
on load:
    broadcast new @{storage}   Output will be whatever you have in that file.
on load:
    set {_example} to new json {"Hello": 1}
    broadcast {_example}
    Output will be plain JsonElement (Json) {"Hello": 1}
Here you can't use double quotes because they are defined for String and therefore you will use single quotes, json will then automatically modify them so that the result is parsable. However, if you still want to use double quotes you will have to double them
on load:
    set {_example} to new json from string "{'Hello': 1}"
    broadcast {_example}
    Output will be plain JsonElement (Json) {"Hello": 1}
JsonPrimitive is a json type that is only 'Integer/Boolean/Double/String'
on load:
    set {_primitive::Integer} to '1'
    set {_primitive::Boolean} to 'false'
    set {_primitive::Double} to '2.2'
    set {_primitive::String} to 'anything'Last updated
Was this helpful?