mercredi 5 août 2015

What should pe POJO for given JSON


I am integrating 3rd party REST API.I have written pojo for given json. Form 3rd party I am getting response in form of json as

"custom_fields": {
            "Field_68092": {
                "type": "char", 
                "required": true, 
                "value": "1", 
                "label": "orderId"
            }
        }

I tried with following POJO

public class Field_68092 {
    private String type;
    private String value;
    private String label;
    private boolean required;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public boolean isRequired() {
        return required;
    }

    public void setRequired(boolean required) {
        this.required = required;
    }
}

and custom filed's pojo is

public class Custom_fields {
    private Field_68092 Field_68092;

    public Field_68092 getField_68092() {
        return Field_68092;
    }

    public void setField_68092(Field_68092 field_68092) {
        Field_68092 = field_68092;
    }
}

Field_68092 every time coming null. can some one help me to find ut what is wrong with POJO structure?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire