Sorry but I am new in Playframwork
wanted download the data from Db as json file. I am able to convert DB data and display on browser but not able to download as json file.
public Result userListToJson() {
List<User> userList = User.find.all();
return ok(Json.toJson(userList))
}
You need to add Content-Disposition
header, so your code will be
public Result userListToJson() {
List<User> userList = User.find.all();
return ok(Json.toJson(userList)).withHeaders("Content-Disposition" -> "attachment; filename=users.json")
}