Hi,
given this model:
interface A<T> extends Map<String, T> {
Map<String, Object> getExtensions();
String getX();
void setX(String x);
}
class Foo extends A<Bar> { }
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", "ext-value");
I want this JSON generated:
{
"bar": {
// bar's properties
},
"x": "y" ,
"ext": "ext-value"
}
So the extensions Map is flattened into the same object as the extended
map. And properties like `x` are included as well.
This has proven hard to configure.
Treating it as bean would require two usages of @JsonAnyGetter (extended
and extension map).
Treating it as map ignores the other properties.
Using custom serializers would need to delegate to a map and a bean
serializer as it would be used if I would not configure a custom
serializer. I failed to do this so far.
Any suggestion is welcome.
Thanks
Jan
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.