---
title: Convert JSON To XML
slug: convert-json-to-xml
docTags: 
createdAt: 2022-12-28T05:31:58.000Z
---

Converts a JSON document to XML.&#x20;

If you have an array to be converted make sure you nest it in a named value before usage like in the example.



### API Definition

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/json/toxml",
  "name": "JSON to XML",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "28UsDqyeH3QRdmtVamSQT",
        "code": "{\n    \"output\": \"<root><record><email>bruce@pathfix.com</email><source>facebook</source><other>test</other><date>2022-01-25</date></record><record><email>paul@pathfix.com</email><source>facebook</source><date>2022-02-12</date></record><record><email>chang@pathfix.com</email><source>linkedin</source><date>2022-02-15</date></record></root>\",\n    \"size_in_bytes\": 581.0\n}",
        "language": "200"
      },
      {
        "id": "yIX64DyIuDPJgBRFSfAWb",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "28UsDqyeH3QRdmtVamSQT"
  },
  "examples": {
    "languages": [
      {
        "id": "ENcJz9TStG38F0X-taA4x",
        "code": "{\r\n    \"input\": {\r\n        \"record\": [\r\n            {\r\n                \"email\": \"bruce@pathfix.com\",\r\n                \"source\": \"facebook\",\r\n                \"other\": \"test\",\r\n                \"date\": \"2022-01-25\"\r\n            },\r\n            {\r\n                \"email\": \"paul@pathfix.com\",\r\n                \"source\": \"facebook\",\r\n                \"date\": \"2022-02-12\"\r\n            },\r\n            {\r\n                \"email\": \"chang@pathfix.com\",\r\n                \"source\": \"linkedin\",\r\n                \"date\": \"2022-02-15\"\r\n            }\r\n        ]\r\n    }\r\n\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "ENcJz9TStG38F0X-taA4x"
  },
  "description": "\nCall the following API:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

















