I have a String with a JSON that contains a list. Its something like this:
{
"counts":[
{"foo827138": 123124, "bar2918":312312, "something_else321-313":2321321},
{"foo1231412": 4321, "bar1231515":123, "something_else3012931":7282},
{"foo1210820": 1234, "bar10293810":3112, "something_else12094":1321}
]
}
After parsing it with BasicDBObject.parse():
DBObject doc = BasicDBObject.parse(jsonString);
How can I get the keys and values on counts list?
PS.: doc.get("counts") returns a BasicDBList object. I can only iterate over this with:
for (Object a : doc) {
// Something
}
Object does not provide a get() method or something like. So I don't know how to get any of my key names and respective values.
BasicDBObjectare you talking about the MongoDB instance of it? can you provide the code where you are calling parse()?