Skip to content Skip to sidebar Skip to footer

Realm.io - Can Json Array Be Parsed Using Createorupdateallfromjson?

Inside Doctor class, I have RealmList - specializationList. public class Doctor extends RealmObject { @PrimaryKey private String doctorId; private FullName fullName;

Solution 1:

Yes, Realm should be able to parse that, but it looks like your naming is not right. Your Doctor class calls it specializationList but in your JSON it is specializations.

If you change your Doctor class to the following it should work:

publicclassDoctorextendsRealmObject{

    @PrimaryKey
    privateString doctorId;
    private FullName fullName;
    private Age age;
    privateString organizationId;
    private Position position;
    privateString category;
    privateString loyalty;
    private RealmList<Specialization> specializations;
    private Contacts contacts;
    privateString key;
....

Post a Comment for "Realm.io - Can Json Array Be Parsed Using Createorupdateallfromjson?"