---
title: Convert List To JSON (Based on Values)
slug: convert-list-to-json-based-on-values
docTags: 
createdAt: 2021-12-22T07:13:36.000Z
---

Convert a JSON Object List to JSON using the values of the input list as key names and values in the output list



### API Definition

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/list/tojson",
  "name": "Convert List Format API",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "m7IPEq52KYRM6IA66pYLJ",
        "code": "{\n\t\"output\": {\n\t\t\"Please_enter_your_name\": \"Ron\",\n\t\t\"Please_enter_your_Title\": \"Mr.\"\n\t}\n}",
        "language": "200"
      },
      {
        "id": "kxpw-BOTV_qAO5LuQhxyh",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "m7IPEq52KYRM6IA66pYLJ"
  },
  "examples": {
    "languages": [
      {
        "id": "6Yq5ApU07EX8G2XQciJa2",
        "code": "{\r\n\t\"input\": [{\r\n\t\t\t\"question\": \"Please enter your name\",\r\n\t\t\t\"answer\": \"Ron\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"question\": \"Please enter your Title\",\r\n\t\t\t\"answer\": \"Mr.\"\r\n\t\t}\r\n\t],\r\n\r\n\t\"key\": \"question\",\r\n\t\"value\": \"answer\",\r\n\t\"key_length\": \"100\"\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "6Yq5ApU07EX8G2XQciJa2"
  },
  "description": "Call the following API:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::




### &#xD;&#xA;&#xD;&#xA;Remarks

The **rule&#x20;**&#x6B;ey in the request is optional.&#x20;

If **drop\_nulls&#x20;**&#x69;s omitted, then in the above scenario, the second item of the output list would have fullName with empty quotes

