Java 在Play框架中从POJO到JSON
试图让Play2.0从POJO返回JSON。但是我收到了错误Java 在Play框架中从POJO到JSON,java,json,playframework-2.0,Java,Json,Playframework 2.0,试图让Play2.0从POJO返回JSON。但是我收到了错误 The method toJson(Writes<A>) in the type Json is not applicable for the arguments (Product) 有什么想法吗?确保使用import play.libs.Json导入正确的Json类 您可能使用了play.api.libs.Json,它针对的是Scala api,而不是Java api public static Result inde
The method toJson(Writes<A>) in the type Json is not applicable for the arguments (Product)
有什么想法吗?确保使用
import play.libs.Json
导入正确的Json
类
您可能使用了play.api.libs.Json
,它针对的是Scala api,而不是Java api
public static Result index(String date) {
Product item = new Product();
return ok(Json.toJson(item));
}