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 | 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) | Set to TRUE to return a textual representation of resulting JSON object. Defaults to FALSE. |
Return
{ JSON } as a placeholder for JSON object or a textual representation, if successful.
Examples
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 S1 the Inbox will be filled with the JSON gathered by B11 |