Component: JSON Encoder (Comms: IoT/Cloud)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 1.0
Category Comms: IoT/Cloud


JSON Encoder component

Allows dynamic key and value pairs to be created and assembled into a formatted JSON string.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_JSONEncoder.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_JSONEncoder.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Simple Data

Example program showing how to use a JSON encoder component to create a simple JSON encoded data string.

FC6 Icon.png JSON Encoder Example

Simple Encode and Decode

Example program showing how to take data and encode it into a JSON string to be sent out over comms.

The example also hows how to decode a received JSON string and pull out values.

FC6 Icon.png JSON_Demo

Macro reference

AssignDataAsFloat

Fc9-comp-macro.png AssignDataAsFloat
Assigns a data value as a floating point value 
Fc9-u16-icon.png - UINT Element
Index of the element to assign the data to 
Fc9-f32-icon.png - FLOAT Data
 
Fc9-u8-icon.png - BYTE NumDP
Number of decimal points 
Fc9-void-icon.png - VOID Return


AssignDataAsNumber

Fc9-comp-macro.png AssignDataAsNumber
Assigns a data value as a integer value 
Fc9-u16-icon.png - UINT Element
Index of the element to assign the data to 
Fc9-s32-icon.png - LONG Data
 
Fc9-void-icon.png - VOID Return


AssignDataAsString

Fc9-comp-macro.png AssignDataAsString
Assigns a data value as a string 
Fc9-u16-icon.png - UINT Element
Index of the element to assign the data to 
Fc9-string-icon.png - STRING Data
 
Fc9-void-icon.png - VOID Return


AssignName

Fc9-comp-macro.png AssignName
Assigns a name value as a string. Call this macro first before assigning data to the element. 
Fc9-u16-icon.png - UINT Element
Index of the element to assign the data to 
Fc9-string-icon.png - STRING Name
 
Fc9-void-icon.png - VOID Return


ClearAll

Fc9-comp-macro.png ClearAll
Clears all the names and data values out of the buffer 
Fc9-void-icon.png - VOID Return


GenerateJSON

Fc9-comp-macro.png GenerateJSON
Generates a JSON data string with the current specified values. 
Fc9-string-icon.png - STRING Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-21-icon.png Data Bytes
Number of bytes used to store the entire data for the JSON message. Includes names and data values so make sure this is large enough to store everything you want to be able to put into a single JSON data string.