Data to JSON

This function block is designed to convert connected data inputs into a JSON format. It allows users to specify headers for the data being logged and outputs the formatted JSON string.

πŸ“₯ Inputs

Start Logging A boolean input that triggers the logging process. When true, the block collects the connected data for JSON output.

Data_1 to Data_10 Generic data inputs that can be connected to various data sources to be included in the JSON.

πŸ“€ Outputs

JSON Data This output provides the generated JSON string based on the input data and specified headers.

πŸ•ΉοΈ Controls

Set Data Headers Text fields where users can specify headers for their data inputs. If left empty, default names Data_1 to Data_10 will be used.

🎨 Features

Flexible Data Input The block can accept up to ten data inputs, allowing for a comprehensive collection of data into JSON format.

Dynamic Header Setting Users can specify custom headers for their data inputs, tailoring the output to fit their needs.

JSON Formatting Automatically converts connected data to JSON format for easy use in further applications or data handling.

πŸ“ Usage Instructions

  1. Connect Data Sources: Link your data sources to the corresponding inputs labeled from Data_1 to Data_10.

  2. Set Headers: Fill in the text fields for headers with meaningful names that represent your data. If you do not fill them, default headers will be used.

  3. Start Logging: Activate the Start Logging input to trigger the conversion process.

  4. Retrieve JSON: The output will provide the generated JSON string containing your data with the specified headers.

πŸ“Š Evaluation

This block will output a JSON string whenever the Start Logging input is initiated, reflecting the current data connected and the defined headers.

πŸ’‘ Tips and Tricks

Validating JSON Format

To ensure correct formatting, consider using an online JSON validator after retrieving your JSON output. This will help to confirm that your generated string is properly structured.

Changing Header Names

If you are identifying a large number of data inputs for different sessions, keep track of your header naming conventions for consistency across different logs.

πŸ› οΈ Troubleshooting

Output JSON Not Showing

Make sure that the Start Logging boolean input is activated, and that you have connected live data to at least one of the data inputs. If no data is connected, the output will be empty.

Mismatch Between Headers and Inputs

If you encounter an error regarding mismatched counts between headers and inputs, verify that the number of active connections to data inputs matches the number of headers you have specified.

Last updated