Trying to get Play 2.0 to return JSON from a POJO. But I recieve the error
The method toJson(Writes<A>) in the type Json is not applicable for the arguments (Product)
And my code is:
public static Result index(String date) {
Product item = new Product();
return ok(Json.toJson(item));
}
Any ideas?
Make sure you import the right Json class using import play.libs.Json.
You probably used play.api.libs.Json which is targeted for the Scala API, not the Java API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With