wangyao5 / json-smart

Automatically exported from code.google.com/p/json-smart
0 stars 0 forks source link

anonation feature request #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. like @JsonIgnore of jackson, in case to ignore some feild.
2. set JSONStyle config to different class of so.
3. and so on.
json-smart will be more powerful.Thanks.

Original issue reported on code.google.com by yunjie....@gmail.com on 1 Oct 2011 at 5:58

GoogleCodeExporter commented 9 years ago
For the moment consider using java transilien keyword to ignore field at java 
serialisation.
I will add jackson @JsonIgnore like interface in json-smart 2.0

Original comment by uriel.chemouni on 10 Oct 2011 at 7:18

GoogleCodeExporter commented 9 years ago
@JsonIgnore is now implemented into branch 2.0

Original comment by uriel.chemouni on 31 Oct 2011 at 7:56

GoogleCodeExporter commented 9 years ago

Original comment by uriel.chemouni on 1 Nov 2011 at 8:56

GoogleCodeExporter commented 9 years ago

Original comment by uriel.chemouni on 1 Nov 2011 at 10:19

GoogleCodeExporter commented 9 years ago

Original comment by uriel.chemouni on 1 Nov 2011 at 9:13

GoogleCodeExporter commented 9 years ago
have a try for JSONValue.parse(String, object) style,works well enough.Thanks.

Original comment by yunjie....@gmail.com on 2 Nov 2011 at 12:55

GoogleCodeExporter commented 9 years ago
and annotation @JsonIgnore for field works,something like
@JsonIgnore
private String desc = "desc";

but get or set method,like:
@JsonIgnore
    public String getDesc() {
        return desc;
    }
@JsonIgnore
    public void setDesc(String desc) {
        this.desc = desc;
    }

JsonIgnore annotation have no affect,I expect we could JsonIgnore before 
seperate set and get method.

Original comment by yunjie....@gmail.com on 2 Nov 2011 at 1:01

GoogleCodeExporter commented 9 years ago
what should append if:
1) @JsonIgnore is present on field, and not present onto getter and setter.

2) @JsonIgnore is present on the field, the getter, and the setter.

3) @JsonIgnore is present on getter and setter, and not present onto the field.

4) if @JsonIgnore is present on getter and setter, and if the field is private?

Original comment by uriel.chemouni on 2 Nov 2011 at 6:22

GoogleCodeExporter commented 9 years ago
JsonIgnore  policy  2) is better, that is 
a.present on the field,ingnore the field when serialization and deserialization
b.present on getter,ingnore the field when serialization;
  present on setter,ingnore the field when deserialization

now we implement JsonIgnore feature a. , better if we have b. also.
by the way,jackson library only implement policy 3) based on my test,also it's 
docments declare on policy 2),see also:
http://jackson.codehaus.org/1.8.4/javadoc/org/codehaus/jackson/annotate/JsonIgno
re.html

Original comment by yunjie....@gmail.com on 4 Nov 2011 at 3:04

GoogleCodeExporter commented 9 years ago
Fixed in json-smart-2.0-beta2

http://code.google.com/p/json-smart/downloads/detail?name=json-smart-2.0-beta2-b
undle.zip

Original comment by uriel.chemouni on 14 Nov 2011 at 9:49