Difference between revisions of "Component: JSON Encoder (Comms: IoT/Cloud)"
From Flowcode Help
Jump to navigationJump to search| Line 26: | Line 26: | ||
==Examples== | ==Examples== | ||
| + | |||
| + | ===Simple Data=== | ||
| + | |||
| + | Example program showing how to use a JSON decoder component to parse a simple JSON encoded data string. | ||
| + | |||
| + | {{Fcfile|Web_JSON_Decoder.fcsx|Web 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. | Example program showing how to take data and encode it into a JSON string to be sent out over comms. | ||
| Line 32: | Line 41: | ||
{{Fcfile|JSON_Demo.fcfx|JSON_Demo}} | {{Fcfile|JSON_Demo.fcfx|JSON_Demo}} | ||
| − | |||
| − | |||
==Macro reference== | ==Macro reference== | ||
Revision as of 10:30, 28 November 2023
| Author | Matrix TSL |
| Version | 1.0 |
| Category | Comms: IoT/Cloud |
Contents
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 decoder component to parse a simple JSON encoded data string.
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.
Macro reference
AssignDataAsFloat
| AssignDataAsFloat | |
| Assigns a data value as a floating point value | |
| Element | |
| Index of the element to assign the data to | |
| Data | |
| NumDP | |
| Number of decimal points | |
| Return | |
AssignDataAsNumber
| AssignDataAsNumber | |
| Assigns a data value as a integer value | |
| Element | |
| Index of the element to assign the data to | |
| Data | |
| Return | |
AssignDataAsString
| AssignDataAsString | |
| Assigns a data value as a string | |
| Element | |
| Index of the element to assign the data to | |
| Data | |
| Return | |
AssignName
| AssignName | |
| Assigns a name value as a string. Call this macro first before assigning data to the element. | |
| Element | |
| Index of the element to assign the data to | |
| Name | |
| Return | |
ClearAll
| ClearAll | |
| Clears all the names and data values out of the buffer | |
| Return | |
GenerateJSON
| GenerateJSON | |
| Generates a JSON data string with the current specified values. | |
| Return | |