This worked at one point in Jackson. I want to apply a filter to objects in a Collection.
reponse.getOriginalResponse() -> Collection
mapper.writer(filterProvider).writeValueAsString(response.getOriginalResponse());
The filter is
this.filters.put("myfilter", SimpleBeanPropertyFilter
.filterOutAllExcept("test"));
The resulting json in the string is the entire object instead of just an array of objects with one property called test...
I am not sure at what point this stopped working or if there was some other configuration that needs to be added to make it work in Jackson
Also tried
SimpleBeanPropertyFilter.serializeAllExcept("test")
There must be some new Trick to telling Jackson that the objects in the Collection are the type I want to filter.
EDIT: I tried it with just one object
MyObject i = ((List<MyObject>) response
.getOriginalResponse()).get(0);
output = mapper.writer(filterProvider).writeValueAsString(i);
And it still output the entire object... filter was essentially ignored...