I work with Mongo using Jongo, when I make a request, I get the result of LinkedHashMap.
Iterator one = (Iterator) friends.find(query).projection("{_id:0}").as(Object.class);
while (one.hasNext()) {
LinkedHashMap data= new LinkedHashMap();
data= (LinkedHashMap) one.next();
String content=data.toString();
}
the problem is that if json is {"user": "something"} content will be {user = something}, it is not json - this is just the toString method from HashMap.
How can I get the original JSON ?.
I don't have a class to map the response to, and this is not a solution creating a map class, so I use Object.class.
source
share