I use play framework for my server-side with the reast api and java for the actual server-side functions. I'm trying to make a simple GET request, to get Array of Json. But it gives me an error in the Users when I use Json.toJson. why is that ??
the User is a simple class for the user object( "user name:, password:, first name: ,last name").
public class Users extends Controller {
private static ArrayList<User> Users = new ArrayList(){{
add(new User("a","2","a","a"));
}};
public static Result index(){
return ok(Json.toJson(Users));
}
}
edit 1 - the answer:
my problem was that I imported the wrong java lib for the play Result . the right one is :
import play.mvc.Result;
my problem was that I imported the wrong java lib for the play Result . the right one is :
import play.mvc.Result;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.