> For the complete documentation index, see [llms.txt](https://docs.arkannis.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arkannis.net/programming/python/frameworks/fastapi/storing-in-array.md).

# Storing in Array

* You could store the info in a Global variable in Memory to test out the functionality

```python
my_posts = [

    {
    "title": "title of post 1",
    "content": "content of post 1",
    "id": 1
    },

    {
    "title": "favorite foods",
    "content": "Pizza",
    "id": 2
    }
]
```

* This creates 2 posts with IDs so we can test out our HTTP Requests
* We have the following python function to retrieve the data

```python
@app.get("/posts")
def get_posts():
    return {"data": my_posts}
```

* If we use a `GET` request via Postman to get the data

![](/files/A2JV21LUBEI8ppxgUrIq)

* We will get the following data

```json
{
    "data": [
        {
            "title": "title of post 1",
            "content": "content of post 1",
            "id": 1
        },
        {
            "title": "favorite foods",
            "content": "Pizza",
            "id": 2
        }
    ]
}
```

* We get the data properties followed by the posts that we have in the List/Array&#x20;


---

# 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:

```
GET https://docs.arkannis.net/programming/python/frameworks/fastapi/storing-in-array.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
