}
public static BasicDBObject gson2MongoObject(JsonElement inElement)
{
JsonObject in = inElement.getAsJsonObject();
BasicDBObject out = new BasicDBObject();
for (Entry<String, JsonElement> entry : in.entrySet())
{
String key = gson2MongoKey(entry.getKey());
JsonElement val = entry.getValue();
if (val.isJsonArray())
{
out.put(key, gson2MongoArray(val));
}
else if (val.isJsonObject())
{
out.put(key, gson2MongoObject(val));
}
else
{
out.put(key, gson2MongoPrimitive(val));
}
}
return out;
}