Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: 2.0.0
-
Fix Version/s: None
-
Component/s: Serializer
-
Labels:None
-
Number of attachments :
Description
I followed the wiki example using Jackson 2.0 and wrote the following code:
ObjectMapper mapper = new ObjectMapper(); // first, construct filter provider to exclude all properties but 'name', bind it as 'myFilter' FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", SimpleBeanPropertyFilter.filterOutAllExcept("name")); // and then serialize using that filter provider: String json = mapper.writer(filters).writeValueAsString(new Object() { public String name = "a"; public int num = 2; }); System.out.println(json);
I had to change "filterWriter(filters)" to "writer(filters)" due to API change from Jackson 1.* to 2.0.
The output of this code is:
{"name":"a","num":2}
I expected to get:
{"name":"a"}
without the "num" property.
It works as expected in Jackson 1.7.4.
Activity
Tatu Saloranta
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Not A Bug [ 6 ] | |
| Status | Open [ 1 ] | Closed [ 6 ] |