Re: [jackson-user] Serialisation of maps as beans

2019-03-19 Thread Jan Bernitt
Using @JsonFormat throws an exception as well. I think your idea merging the maps would work but creates unwanted API and intermediate objects. FYI: I ended up using @JsonSerializer(using =...) (note that as does not work when interface already implements Map) and implemented a fully custom

Re: [jackson-user] Serialisation of maps as beans

2019-03-18 Thread Tatu Saloranta
On Mon, Mar 18, 2019 at 7:28 PM Jan Bernitt wrote: > > Hi, > > given this model: > > interface A extends Map { > > Map getExtensions(); > > String getX(); > > void setX(String x); > } > > class Foo extends A { } > class Bar { } > > Filling it with data: > > Foo foo = new Foo(); >

[jackson-user] Serialisation of maps as beans

2019-03-18 Thread Jan Bernitt
Hi, given this model: interface A extends Map { Map getExtensions(); String getX(); void setX(String x); } class Foo extends A { } class Bar { } Filling it with data: Foo foo = new Foo(); foo.put("bar", new Bar()); // using it as Map foo.setX("y"); foo.getExtension().put("ext",