Cannot able to add nested object inside Couchbase lite field on Android


I have generic function to create Couchbase lite documents as follows:

protected Document saveDocument(Document document, Map<String, Object> docData) {
try {
} catch (CouchbaseLiteException e) {
return null;
return document;

But when I want to add HashMap as a value e.g.:

Map<String, Object> docData = new HashMap();

Map<String, Object> nestedObject = new HashMap();

nestedObject.put(“key1”, 1);
nestedObject.put(“key2”, 2);

docData.put(“nestedObject”, nestedObject)

//save to cb lite
saveDocument(docInstance, docData)

it works OK. But when I try to receive my field “nestedObject” I got string, not HashMap or LinkedHaskMap (usually this I got from Couchbase when syncing).

Am I doing something wrong here? How to created nested objects in Couchbase lite?

May be you can refer this unit test?