> For the complete documentation index, see [llms.txt](https://chat-sdk.gitbook.io/android/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chat-sdk.gitbook.io/android/api/handling-structured-meta-data.md).

# Handling Structured Meta Data

In Android, the ORM we use (GreenDAO) can’t store arrays or maps. It can only store key, value pairs. The ORM we use for iOS (CoreData) on the other hand can store maps and dictionaries. That means that to store structured data for Android we need to take another approach.&#x20;

Imagine the following data that we want to add to a message's meta payload:&#x20;

```
{
    key1: {
        sub1: “a”,
        sub2: “b”
    },
    key2: “c"
}
```

To store this in Android we would need to do the following:&#x20;

```java
message.setValueForKey(“a", "key1/sub1”);
message.setValueForKey(“b", "key1/sub2");
message.setValueForKey(“c", "key2");
```

You can also use the `HashMapHelper` class to convert between these two representations:&#x20;

```java
Map<String, String> sub = new HashMap<String, String>() {{
            put("sub1", "a");
            put("sub2", "b");
        }};
Map<String, Object> map = new HashMap<String, Object>() {{
    put("key1", sub);
    put("key2", "c");
}};
```

You can then flatten the map:

```java
Map<String, Object> flat = HashMapHelper.flatten(map);
```

This yields:

```java
{
  key2=c, 
  key1/sub2=b, 
  key1/sub1=a
}
```

&#x20;You can also expand the map:

```java
Map<String, Object> expanded = HashMapHelper.expand(flat);
```

Which yields:

```java
{
  key2=c, 
  key1={
    sub1=a, 
    sub2=b
  }
}
```


---

# 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://chat-sdk.gitbook.io/android/api/handling-structured-meta-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.
