I\'m Workin with Mongo using Jongo, when I do a query I receive a LinkedHashMap
as result.
Iterator one = (Iterator) friends.find(query).project
If you have access to some JSON library, it seems like that's the way to go.
If using org.json library, use public JSONObject(java.util.Map map):
String jsonString = new JSONObject(data).toString()
If Gson, use the gson.toJson() method mentioned by @hellboy:
String jsonString = new Gson().toJson(data, Map.class);