0

NOT DUPLICATE, I TRY DID LIKE IN THAT POST, NOT WORK

Sorry for my English. I use retrofit in my android application, and I have some problem with JSON, I try parsing JSON like this:

[
 {
  "FIELDS": {
     "ID": "21"
   },
   "PROS": []
 },
{
  "FIELDS": {
     "ID": "21"
   },
   "PROS": []
 }
]

this is my object:

public class In_Catalog {

    @SerializedName("FIELDS")
    FIELDS FIELDS;

    public In_Catalog.FIELDS getFIELDS() {
        return FIELDS;
    }

    public void setFIELDS(In_Catalog.FIELDS FIELDS) {
        this.FIELDS = FIELDS;
    }

public class FIELDS {
String ID;
 public String getID() {
            return ID;
        }

        public void setID(String ID) {
            this.ID = ID;
        }
}

This is my interface

Observable<List<In_Catalog>> getProductsInCatalog(@Query("section") int id_selection);

I cant parse JSON, my FIELDS object is always NULL. What I do wrong?

2
  • it not DUBLICATE it different, and i try did like in that post. Commented Jul 5, 2018 at 10:06
  • I solved your question. please refer this notes.io/mg3R Commented Jul 5, 2018 at 10:09

1 Answer 1

2
public class ResultDTO {

@SerializedName("FIELDS")
private com.universal.jainconnection.data.FIELDS mFIELDS;
@SerializedName("PROS")
private List<Object> mPROS;
}


public class FIELDS {

@SerializedName("ID")
private String mID;
}

replace this

Observable<List<ResultDTO >> getProductsInCatalog(@Query("section") int id_selection);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.