FasterXML / FasterXML/jackson-annotations

FEATURE: Allow to specify a Json View to serialize a property of an object

Đang mở
#132 4 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
1.1k
Fork
342
Merge trung bình
8 giờ 53 phút
Pull request đã merge (30 ngày)
2

Mô tả

Currently it's not possible to serialize the property of an object specifying a Json view. Please create a new **`@JsonUseView`** annotation to be able to specify a view used to serialize the property.

```
public class Company {
@JsonView(View.Basic.class)
private Long id;

@JsonView(View.Basic.class)
private String name;

private String extraData;
private String sensitiveData;
private String privateData;
...
}

public class User{
private Long id;
private String name;

@UseJsonView(View.Basic.class)
private Company company;
...
}
```

Or create a new set of annotations that allow this feature. For example:

```
@JsonViews(views={
@View(name="basic", fields=["id", "name"]),
@View(name="otherView", fields=["id", "name", "extraData"]),
})
public class Company {
private Long id;
private String name;
private String extraData;
private String sensitiveData;
private String privateData;
...
}

public class User{
private Long id;
private String name;

@UseJsonView("basic")
private Company company;
...
}
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.