---
title: Fetch JSON Node or List based on XPath Query
slug: fetch-json-node-or-list-based-on-xpath-query
docTags: 
createdAt: 2022-11-25T14:50:43.000Z
---

Fetch a JSON Object or List from the input based on an xpath query.



### API Definition

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/json/xpath_getobjects",
  "name": "Fetch JSON from XPath API",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "28UsDqyeH3QRdmtVamSQT",
        "code": "{\n    \"output\": {\n        \"root\": {\n            \"company\": {\n                \"name\": \"Pathfix\"\n            }\n        }\n    }\n}",
        "language": "200"
      },
      {
        "id": "yIX64DyIuDPJgBRFSfAWb",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "28UsDqyeH3QRdmtVamSQT"
  },
  "examples": {
    "languages": [
      {
        "id": "ENcJz9TStG38F0X-taA4x",
        "code": "{\r\n\t\"input\": {\r\n\t\t\"details\":{\r\n\t\t\t\"first_name\":\"Bruce\",\r\n\t\t\t\"last_name\":\"Wayne\"\r\n\t\t\t\"company\": {\r\n\t\t\t\t\"name\": \"Pathfix\"\r\n\t\t\t}\r\n\t\t}\r\n\t\t\"xpath\": \"//company\"\r\n\t}\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "ENcJz9TStG38F0X-taA4x"
  },
  "description": "\nCall the following API:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

















