> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xsiam/configure-cortex-xsiam/automations/lists/use-cases-json-lists/extract-a-subset-of-the-data.md).

# Extract a subset of the data

Extract a subset of data from a Cortex XSIAM JSON list.

In a playbook, you can extract subsets of context data to analyze a specific information set. This approach also applies when working with lists, such as extracting a subset of data from a JSON object. In this example, we extract server information from the list created above.

1. In a playbook, create a task.
   1. In the Choose Script field, select Set .
   2. In the key field, define a context key name for the data; for example, JSONDataSubset.
   3. In the value field, set the list you want to extract by clicking the curly brackets.
   4. Click Filters And Transformers.
   5. In the Get field, enter **`lists.Test1.domain.servers`**.
   6. In the Fetch data field, select an issue to test the data.
   7. Click Test.
   8. When the test completes, click Save.
   9. Save the task and the playbook.
2. Check that all the data is stored in the context key you defined by testing the playbook using the debugger.
   1. Click **`Run`** Debugger Panel.
   2. The key you defined (JSONDataSubset) holds the subset of the data in context from the JSON object.

      [![work-with-json-lists-subset-8x.png](https://docs-cortex.paloaltonetworks.com/api/khub/maps/5CAbsl8idaK8R43ZLhoTOw/resources/UfEhYthyCCam5cqqwiiSRQ-5CAbsl8idaK8R43ZLhoTOw/content?v=508f115bed9cc5d7\&Ft-Calling-App=ft/turnkey-portal)](https://docs-cortex.paloaltonetworks.com/viewer/attachment/5CAbsl8idaK8R43ZLhoTOw/UfEhYthyCCam5cqqwiiSRQ-5CAbsl8idaK8R43ZLhoTOw)


---

# 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://cortex-docs.paloaltonetworks.com/cortex-xsiam/configure-cortex-xsiam/automations/lists/use-cases-json-lists/extract-a-subset-of-the-data.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.
