It seems you can\'t mix @JsonIgnore and @JsonView. I want to hide a field by default, but show it in some cases.
Basically I\'ve got this setup :-
class
Once you have an object mapper, you can effectively use it in the same way as you are currently using play.libs.Json.toJson(parent)
, and get exactly what you want.
So whenever you were previously using play.libs.Json.toJson(parent)
, just use new ObjectMapper().writeValueAsString()
and you won't get your secret.