JSON
A Streamsheet has the possibility to process, generate and accumulate data. Before sending this data, the cells from a data range have to be structured, in order for an App to interpret them correctly. JSON() is paring two columns together to a key and value pair using the JSON Syntax. Alternatively it is possible to specify a text which will be parsed to JSON or use one of the various INBOX/OUTBOX functions to reference an element from a message stored in inbox or outbox respectively. The optional second parameter can be used to convert the resulting JSON object to a textual representation. This function is mostly used within publish functions like: MQTTPUBLISH. The JSON structure supports quotes "". eg. {"Key":"value"}
Syntax
=JSON(DataRangeOrTextOrInboxOutboxFunction, [ResultAsText])
Arguments
Name | Type | Description |
---|---|---|
DataRangeOrTextOrInboxOutboxFunction | A data range over at least two columns, only interpreting the first and last column into the JSON object. Or a text which will be evaluated to JSON. Or an INBOX/OUTBOX function to reference an element of a message. | |
ResultAsText (optional) | Boolean | Set to TRUE to return a textual representation of resulting JSON object. Default value: FALSE |
Return
Type | Description |
---|---|
JSON | { JSON } as a placeholder for JSON object or a textual representation, if successful. |
Examples
A | B | |
---|---|---|
1 | values | |
2 | temperature | 16918 |
3 | CO2 | 49 |
4 | ||
5 | {"values":{"temperature":16918,"CO2":49}} |
Formula | Result | Comment |
---|---|---|
| { JSON } | This is the representation of a cell filled with JSON data. |
| {"values":{"temperature":16918,"CO2":49}} | The textual representation of resulting JSON data. |
| { JSON } | This is the representation of a cell filled with JSON data. |
| { JSON } | This is the representation of a cell filled with JSON data. Internally the cell has a JSON object which represents the "Customer" value from specified outbox message. |
| In Streamsheet Sheet1 the Inbox will be filled with the JSON |