Lua to JSON
Description
The Lua to JSON part allows you to convert data between Lua and JSON data formats. You can use it to convert text strings from a Lua data format to a JSON format and vice versa. This part also has a parameter that allows you to format the JSON output so it is easier to read.
Node Type: This part is located in process nodes under the Misc category.
Used With: This part can be used with all framework-based projects as well as with projects that do not use a framework.
Editor Fields
Field Name |
Description/Use |
Type/Options |
Optional/Mandatory |
Mode |
This is the direction of the conversion. |
Lua to JSON | |
Mandatory |
Input path |
This is the name of the data object containing either Lua or JSON data. |
Data Object |
Mandatory |
Output path |
This is the data object where the result will be stored. |
Data Object |
Mandatory |
Batch |
If this is set to 'yes', the system treats the input path as a collection of formatted data, converting each element and storing the results in the output path. |
Yes | No |
Optional |
Boolean Support |
When converting from LUA to JSON, select Yes to turn on support for Boolean values (variables set to true, false, and null are all converted correctly into corresponding JSON objects). |
Yes | No |
Optional |
False value (default nil) (pre Release 7.4) |
Booleans are not converted automatically from JSON to LUA format in LogicNets pre Release 7.4. Therefore, a Boolean in JSON is converted into a LUA data object with the following override. |
Text |
Optional |
Beautify output |
If you are using the Lua to JSON option the system will display this checkbox. If this checkbox is checked the system will format the JSON output so it is more easily readable. |
Checkbox |
Optional |
Example
Download and import the following example projects in your workspace.