# JsonObject - Funzione per script e grafici

JsonObject viene utilizzato per creare oggetti JSON.

Nota informaticaÈ possibile aggiungere un numero qualsiasi di coppie nome-valore con JsonObject.

Sintassi:

JsonObject(name, value [name, value, ...])

Tipo di dati restituiti: duale

Argomenti

| Argomento | Descrizione |
| --- | --- |
| json | Stringa contenente dati JSON. |
| nome | Il nome del campo in formato JSON. |
| value | Il valore della stringa in formato JSON. |

Esempio:

Il seguente script di caricamento carica e imposta i dati come un oggetto JSON.

```
Data:
Load *,
	JsonObject('id', Id,
		'name', Name,
		'address', Address,
		'phone', Phone,
		'fax', FaxOrNull) AS Json;

LOAD *, If(Fax='-',Null(),Fax) AS FaxOrNull;

LOAD * INLINE [
	Id, Name,       Address,     Phone,     Fax
	1,  John Doe,   Oak Way,   1 234 567, 1 234 568
	2,  Jane Doe, Maple Way, 123456,    -
	3,  Mr Xavier,       Spruce Way,   1-800-MRX
];
```

Il risultato è la seguente tabella dati:

```
{"id":1,"name":"John Doe","address":"Oak Way","phone":"1 234 567","fax":"1 234 568"}
{"id":2,"name":"Jane Doe","address":"Maple Way","phone":123456}
{"id":3,"name":"Mr Xavier","address":"Spruce Way","phone":"1-800-MRX","fax":""} 
```