tags:

views:

25

answers:

1

Hi all,

I have a bean structure to parse JSon files. I am facing one problem, to the same fild, I find two different data types in two different JSon files.
String array

"Keywords": ["90NSB12596","Slam","Dunk","FullBodyIsolated","Action"],  

String

"Keywords": "Basketball|NBA",

How could I different theese two files? My bean struct is:

public String[] getKeywords2() {
        return keywords2;
    }
    @JsonProperty("Keywords")
    public void setKeywords2(String[] keywords2) {
        this.keywords2 = keywords2;
    }
    public String getKeywords() {
        return keywords;
    }
    @JsonProperty("Keywords")
    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }
    public String getCaptionAbstract() {
        return captionAbstract;
    }

Of course this is wrong, I would like to find the way to different theese two @JsonProperty("Keywords")
Thanks in advance

A: 

I decided to find a easy and quick solution.
Add @JsonIgnoreProperties(ignoreUnknown=true) in th ebeggining of the bean, so the program just ignore this field.
I would like to know if there is a better solution, so if someone has another idea, please let me know!

Thanks

mujer esponja