> 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-agentix/configure-cortex-agentix/automations/lists/use-cases-json-lists/extract-a-subset-of-the-data.md).

# Extract a subset of the data

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)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-agentix/configure-cortex-agentix/automations/lists/use-cases-json-lists/extract-a-subset-of-the-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
