Wednesday, March 29, 2017

How to convert DBCursor to JsonNode in Play

The code below only applicable when using mongoDB and Play framework together.


com.mongodb.util.JSON json =new JSON();
String serializedCursor = json.serialize(cursor);

com.fasterxml.jackson.databind.JsonNode jsonData = play.libs.Json.parse(serializedCursor);




Done!!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...