Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve @JsonProperty for nested object. #59

Open
PrzemyslawZajac88 opened this issue Jun 15, 2021 · 1 comment
Open

Improve @JsonProperty for nested object. #59

PrzemyslawZajac88 opened this issue Jun 15, 2021 · 1 comment

Comments

@PrzemyslawZajac88
Copy link

PrzemyslawZajac88 commented Jun 15, 2021

For 10 years I missing this feature. .

Better way of deserializing objects:

       @JsonPropertySerializedDefinition("_embeded", "object")  //optional
       Class SomeDto  {

                  @JsonProperty("_embeded.product") 
                  private Product product;
              
                  @JsonProperty("_embeded.related[].product")
                  private List<Product> products;
              
                  @JsonProperty("_embeded.related[0].product")
                  private Product firstProduct;
              
                  @JsonProperty("_embeded.related[0].product.info.lang.us.prices.best[0]")
                  private BigDecimal bestProductPrice;
       }

`
hope this explains what I'm missing.

  1. nice to have extension:

    @JsonAliasPath("prices", "_embeded.related[0].product.info.lang.us.prices" )
    class SomeDto {
    
             @JsonProperty("prices.best[0]")
             private BigDecimal bestProductPrice;
    
             @JsonProperty("prices.withTax")
             private Float tax;
    }
    
@cowtowncoder
Copy link
Member

I think I get the gist: ability to extract properties from deeper hierarchy.
There are technical challenges wrt trying to implement this, but I will transfer this into repo that has ideas for new features.

@cowtowncoder cowtowncoder transferred this issue from FasterXML/jackson-annotations Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants