> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/lua-to-json.md).

# 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | <p>Lua to JSON | <br>JSON to Lua</p> | Mandatory |
| Input path                                               | <p>This is the name of the data object containing either Lua or JSON data.<br>If this is a <strong>collection</strong> of data strings, set Batch to 'yes'.</p>                                                                                                                                                                                                                                                                                                                                                                             | 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            |           |
| <p>False value (default nil)<br>(Before Release 7.4)</p> | <p>Prior to Release 7.4, LogicNets does not automatically convert Booleans from JSON to LUA format. Therefore, a Boolean in JSON is converted into a LUA data object with the following override.<br>- A Boolean with the value <em>true</em> is converted to 1.<br>- A Boolean with the value <em>false</em> is converted to nil by default. This means that the variable is not available/saved in the LogicNets context.<br>If you want the variable to be available in LogicNets, you can specify the value manually in this field.</p> | 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](/release-9/example-gallery/example-projects-for-parts/lua-to-json-example-projects.md) in your workspace.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/lua-to-json.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
