> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.utils.xml.JsonToXml

- Component: `appmixer.utils.xml.JsonToXml`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.utils.xml 1.0.8](https://connectors.appmixer.com/connector/appmixer.utils.xml/1.0.8.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.utils.xml/1.0.8/component/appmixer.utils.xml.JsonToXml>

Convert JSON to XML.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| JSON (`json`) | textarea | JSON to convert to XML. |
| Array Node Name (`arrayNodeName`) | text | When you build XML from a JSON array, set node name for the array items. E.g. for "car": [{ "color": "blue" }, { "color": "black" }] -> <car><color>blue</color></car><car><color>black</color></car> |
| Attribute Name Prefix (`attributeNamePrefix`) | text | To recognize attributes in JSON object so that they can be trimmed. |
| Attributes Group Name (`attributesGroupName`) | text | To recognize attribute properties group in the JS object so that they can be trimmed and can form attribute expresstion for a tag. This property is not supported when 'Preserve Order' is set because attributes are already grouped. |
| CDATA Property Name (`cdataPropName`) | text | To recognize CDATA properties in a JSON object so that they can be transformed correcty. |
| Comment Property Name (`commentPropName`) | text | To recognize comments in a JSON object so that they can be transformed correcty. |
| Format (`format`) | toggle | By default, parsed XML is single line XML string. By settingh 'Format', you can format it for better view. |
| Ignore Attributes (`ignoreAttributes`) | toggle | Don't consider attributes while building XML. Other attributes related properties should be set to correctly identifying an attribute property. |
| Indentation (`indentBy`) | number | Applicable only if 'Format' is set. |
| Preserve Order (`preserveOrder`) | toggle | Preserve order. |
| Process Entities (`processEntities`) | toggle | Process default and DOCTYPE entites. |
| Stop Nodes (`stopNodes`) | text | Comma separated list of JSON paths to properties that will be skipped from processing. |
| Suppress Boolean Attributes (`suppressBooleanAttributes`) | toggle | Set to parse attributes without their value. |
| Suppress Empty Node (`suppressEmptyNode`) | toggle | Set if you want tags with no text value to be parsed as empty tags. |
| Suppress Unpaired Node (`suppressUnpairedNode`) | toggle | Set if you want suppress unpaired tags e.g. from <br/> to <br>. |
| Text Node Name (`textNodeName`) | text | To recognize text value for a tag in the JSON object so that they can be properly assigned to the tag. |
| Unpaired Tags (`unpairedTags`) | text | Unpaired Tags are the tags which don't have a matching closing tag. Eg <br> in HTML. Parse unpaired tags by providing their comma separated list. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| XML (`xml`) | string | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.utils.xml.JsonToXml",
  "author": "David Durman <david@client.io>",
  "description": "Convert JSON to XML.",
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "json": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object"
              }
            ]
          },
          "arrayNodeName": {
            "type": "string"
          },
          "attributeNamePrefix": {
            "type": "string"
          },
          "attributesGroupName": {
            "type": "string"
          },
          "cdataPropName": {
            "type": "string"
          },
          "commentPropName": {
            "type": "string"
          },
          "format": {
            "type": "boolean"
          },
          "ignoreAttributes": {
            "type": "boolean"
          },
          "indentBy": {
            "type": "integer"
          },
          "preserveOrder": {
            "type": "boolean"
          },
          "processEntities": {
            "type": "boolean"
          },
          "stopNodes": {
            "type": "string"
          },
          "suppressBooleanAttributes": {
            "type": "boolean"
          },
          "suppressEmptyNode": {
            "type": "boolean"
          },
          "suppressUnpairedNode": {
            "type": "boolean"
          },
          "textNodeName": {
            "type": "string"
          },
          "unpairedTags": {
            "type": "string"
          }
        }
      },
      "inspector": {
        "inputs": {
          "json": {
            "type": "textarea",
            "label": "JSON",
            "index": 1,
            "tooltip": "JSON to convert to XML."
          },
          "arrayNodeName": {
            "type": "text",
            "label": "Array Node Name",
            "index": 2,
            "tooltip": "When you build XML from a JSON array, set node name for the array items. E.g. for \"car\": [{ \"color\": \"blue\" }, { \"color\": \"black\" }] -> &lt;car&gt;&lt;color&gt;blue&lt;/color&gt;&lt;/car&gt;&lt;car&gt;&lt;color&gt;black&lt;/color&gt;&lt;/car&gt;"
          },
          "attributeNamePrefix": {
            "type": "text",
            "label": "Attribute Name Prefix",
            "defaultValue": "@",
            "index": 3,
            "tooltip": "To recognize attributes in JSON object so that they can be trimmed."
          },
          "attributesGroupName": {
            "type": "text",
            "label": "Attributes Group Name",
            "index": 4,
            "tooltip": "To recognize attribute properties group in the JS object so that they can be trimmed and can form attribute expresstion for a tag. This property is not supported when 'Preserve Order' is set because attributes are already grouped."
          },
          "cdataPropName": {
            "type": "text",
            "label": "CDATA Property Name",
            "index": 5,
            "tooltip": "To recognize CDATA properties in a JSON object so that they can be transformed correcty."
          },
          "commentPropName": {
            "type": "text",
            "label": "Comment Property Name",
            "index": 6,
            "tooltip": "To recognize comments in a JSON object so that they can be transformed correcty."
          },
          "format": {
            "type": "toggle",
            "label": "Format",
            "defaultValue": false,
            "index": 7,
            "tooltip": "By default, parsed XML is single line XML string. By settingh 'Format', you can format it for better view."
          },
          "ignoreAttributes": {
            "type": "toggle",
            "label": "Ignore Attributes",
            "defaultValue": false,
            "index": 8,
            "tooltip": "Don't consider attributes while building XML. Other attributes related properties should be set to correctly identifying an attribute property."
          },
          "indentBy": {
            "type": "number",
            "label": "Indentation",
            "index": 9,
            "tooltip": "Applicable only if 'Format' is set."
          },
          "preserveOrder": {
            "type": "toggle",
            "label": "Preserve Order",
            "defaultValue": false,
            "index": 10,
            "tooltip": "Preserve order."
          },
          "processEntities": {
            "type": "toggle",
            "label": "Process Entities",
            "defaultValue": false,
            "index": 11,
            "tooltip": "Process default and DOCTYPE entites."
          },
          "stopNodes": {
            "type": "text",
            "label": "Stop Nodes",
            "index": 12,
            "tooltip": "Comma separated list of JSON paths to properties that will be skipped from processing."
          },
          "suppressBooleanAttributes": {
            "type": "toggle",
            "label": "Suppress Boolean Attributes",
            "defaultValue": false,
            "index": 13,
            "tooltip": "Set to parse attributes without their value."
          },
          "suppressEmptyNode": {
            "type": "toggle",
            "label": "Suppress Empty Node",
            "defaultValue": false,
            "index": 14,
            "tooltip": "Set if you want tags with no text value to be parsed as empty tags."
          },
          "suppressUnpairedNode": {
            "type": "toggle",
            "label": "Suppress Unpaired Node",
            "defaultValue": false,
            "index": 15,
            "tooltip": "Set if you want suppress unpaired tags e.g. from &lt;br/&gt; to &lt;br&gt;."
          },
          "textNodeName": {
            "type": "text",
            "label": "Text Node Name",
            "index": 16,
            "tooltip": "To recognize text value for a tag in the JSON object so that they can be properly assigned to the tag."
          },
          "unpairedTags": {
            "type": "text",
            "label": "Unpaired Tags",
            "index": 17,
            "tooltip": "Unpaired Tags are the tags which don't have a matching closing tag. Eg &lt;br&gt; in HTML. Parse unpaired tags by providing their comma separated list."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "options": [
        {
          "label": "XML",
          "value": "xml",
          "schema": {
            "type": "string",
            "example": "<note><to>Jane Doe</to><body>Meeting at 10am</body></note>"
          }
        }
      ]
    }
  ],
  "icon": "(data URI omitted)"
}
```
