> For the complete documentation index, see [llms.txt](https://cooffeerequireds.gitbook.io/skript-gson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cooffeerequireds.gitbook.io/skript-gson/foundations/creating.md).

# Creating

Official docs of Skript-gson

Examples of json creating

{% tabs %}
{% tab title="json from file" %}
Getting json from a file

```vbnet
options:
    storage: json from file "plugins/YourAwesome/storage.json"

on load:
    broadcast new @{storage}   
```

{% hint style="success" %}
Output will be whatever you have in that file.
{% endhint %}
{% endtab %}

{% tab title="json from literal" %}

```vbnet
on load:
    set {_example} to new json {"Hello": 1}
    broadcast {_example}
    
```

{% hint style="success" %}
Output will be plain JsonElement (Json) `{"Hello": 1}`
{% endhint %}
{% endtab %}

{% tab title="json from string" %}
{% hint style="warning" %}
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
{% endhint %}

```vbnet
on load:
    set {_example} to new json from string "{'Hello': 1}"
    broadcast {_example}
    
```

{% hint style="success" %}
Output will be plain JsonElement (Json) `{"Hello": 1}`
{% endhint %}
{% endtab %}

{% tab title="json from variable" %}
{% hint style="info" %}
Here you can create json from a sheet variable to help insert key and value into the sheet. However, we'll talk more in the [**Serialize tutorial**](/skript-gson/foundations/serialization.md)
{% endhint %}
{% endtab %}

{% tab title="json primitive" %}
**JsonPrimitive** is a json type that is only `'Integer/Boolean/Double/String'`

{% hint style="info" %}
[Java Documents](https://javadoc.io/doc/com.google.code.gson/gson/2.6.2/com/google/gson/JsonPrimitive.html)\ <mark style="color:purple;">A class representing a Json primitive value. A primitive value is either a String, a Java primitive, or a Java primitive wrapper type.</mark>
{% endhint %}

```vbnet
on load:
    set {_primitive::Integer} to '1'
    set {_primitive::Boolean} to 'false'
    set {_primitive::Double} to '2.2'
    set {_primitive::String} to 'anything'
```

{% endtab %}
{% endtabs %}
