FasterXML / FasterXML/jackson-future-ideas

Improve @JsonProperty for nested object.

Aperta
#59 1 commento 38 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
21
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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 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.

2. 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;
}

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.