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