I currently have a function that returns a JSON version of an object:
public class Debate extends Controller
{
public static Result viewArgument(Long id)
{
...
return ok(Json.toJson(Argument.get(id)));
}
}
This Argument
object has some confidential information that should not be exposed to the client, however. How can I select only the fields id
and summary
to be returned in the resulting JSON object?
There is a simpler answer, just add @JsonIgnore to the other fields.