Component: JSON Decoder (Comms: IoT/Cloud)

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


JSON Decoder component

Allows dynamic key and value pairs to be collected from a formatted JSON string.

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

Simple Decode

Example program showing how to use a JSON decoder component to parse a simple JSON encoded data string. FC6 Icon.png JSON Decoder 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

FindName

Fc9-comp-macro.png FindName
Searches for a name in the JSON data. Returns the data index position. Returns -1 if the name was not found. 
Fc9-string-icon.png - STRING Name
 
Fc9-u16-icon.png - UINT SkipCount
Number of matches to skip before returning. 
Fc9-s16-icon.png - INT Return


ParseJSON

Fc9-comp-macro.png ParseJSON
Accepts a JSON formatted data string and stores locally in the data buffer ready for parsing. Returns the estimated number of name and data keys present. 
Fc9-string-icon.png - STRING Data
JSON data string to parse 
Fc9-u16-icon.png - UINT Return


ReadDataAsFloat

Fc9-comp-macro.png ReadDataAsFloat
Reads the data of a specific element as a floating point value 
Fc9-u16-icon.png - UINT Element
Index of the element to read 
Fc9-f32-icon.png - FLOAT Return


ReadDataAsNumber

Fc9-comp-macro.png ReadDataAsNumber
Reads the data of a specific element as a numeric integer value 
Fc9-u16-icon.png - UINT Element
Index of the element to read 
Fc9-s32-icon.png - LONG Return


ReadDataAsString

Fc9-comp-macro.png ReadDataAsString
Reads the data of a specific element as a string value 
Fc9-u16-icon.png - UINT Element
Index of the element to read 
Fc9-string-icon.png - STRING Return


ReadName

Fc9-comp-macro.png ReadName
Reads the name of a specific element 
Fc9-u16-icon.png - UINT Element
The Index of the element to read 
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.