# Creating

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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cooffeerequireds.gitbook.io/skript-gson/foundations/creating.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
