# RANGETOJSON

#### Syntax

**RANGETOJSON**(*values*, *keys*)

1. *values* - the values which should be added to the json string - ***Value type**: any*
2. *keys* - the keys which are added to the json string - ***Value type**: text (optional)*

#### Remarks

* The json string is created in the following way:
  * If *keys* is specified, *values* are packaged as **key-value pairs** into the json string in the following way:
    * if *values* contains only one row, the json string consists on one object, including the key-value pairs of *keys* and their corresponding *values*.
    * if values contains multiple row, the json string consists on an array with one object per row, including the key-value pairs of *keys* and their corresponding *values (in the same way as above)*.
  * If *keys* is not specified, *values* are packaged as **array elements** into the json string, in the following way:
    * every row of values is added as an element of the array
    * if a row contains more than one cell, every cell content of the row is added as an element to a sub-array to the outer array

#### Examples

**Example 1**: The content of the *#keys* and *#values* widgets are used to create a json object string.

<figure><img src="/files/cm5TijbVjFxQPfwhRUXw" alt=""><figcaption></figcaption></figure>

**Example 2**: The same as example 1, but the *#values* widget contains now multiple rows. Every row is then added as a separate object in the json string.

<figure><img src="/files/PNO2FlRajadSOt6d2vue" alt=""><figcaption></figcaption></figure>

**Example 3:** If no keys are specified, only the #values is added in the json string.

<figure><img src="/files/cHh2v2oOM78Smy8HqSlW" alt=""><figcaption></figcaption></figure>

**Example 4**: This structure can be used to create a json string with only one array, containing values.

<figure><img src="/files/ZTEqMqNzm4WE5gNOsKlT" alt=""><figcaption></figcaption></figure>

**Example 5**: Same as example 3, but with multiple lines in #values. This returns then a json string containing a nested array of values.

<figure><img src="/files/iaSMSiYGgseI2sU6hWgy" alt=""><figcaption></figcaption></figure>


---

# 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://docs.nedyx.com/nedyx/clearlines-functions/range-functions/rangetojson.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.
