FasterXML / FasterXML/jackson-databind
@JsonUnwrapped completeness: allow more flexible renaming
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.5k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 30
Description
Prefix and Suffix not sufficient for every use case.
While a very narrow use case consider following example:
``` java
class Rectangle {
@JsonUnwrapped(prefix="topLeft")
Point topLeft;
@JsonUnwrapped(prefix="bottomRight")
Point bottomRight;
}
```
For now this would be serialized as:
{
topLeft.x: 0,
topLeft.y: 0,
bottomRight.x: 2048.
bottomRight.y: 1080
}
From documentation it would seem its not possible to coerce Jackson into serializing it as:
{
left: 0,
top: 0,
right: 2048
bottom: 1080,
}
I am not entirely sure that this is even possible but I suppose something along the lines of:
``` java
class Rectangle {
@JsonUnwrapped(
names = {"x","y"},
renames= {"left", "top"}
)
Point topLeft;
@JsonUnwrapped(
names = {"x","y"},
renames= {"right", "bottom"}
)
Point bottomRight;
}
```
Would cover all thinkable use cases.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.