在Android中使用Firestore,是否可以读取下面嵌套对象“items”中的键?
{
"email":"[email protected]",
"items": {
"8G9RiMgx9SmDLYrQbNrN": true,
"K19RiMr7SmDLYrQbNrN": true
}
}
如果您有一个代表该 JSON 结构的FirestoreDocumentSnapshot
,您可以通过以下方式获取项目的键:
DocumentSnapshot document = ...
Map<String, Object> items = (Map<String, Object>) document.get("items");
Set<String> keys = items.keySet();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句