Can't upload/update array of objects related with BackendlessUser

Can’t upload/update array of objects NDevice[] related with BackendlessUser.
field android_id is unique.
I have next error:
BackendlessFault{ code: ‘IllegalArgumentException’, message: ‘java.lang.Object[] cannot be cast to java.util.Map’ }

I think the main problem that I can convert hashmap to NDevice[] array, but it’s not possible to convert from NDevice[] to hashmap fields and set them to BackendlessUser

Application class:

Backendless.Data.mapTableToClass("NDevice", NDevice.class);
Backendless.initApp(this, Consts.BACKENDLESS_APP_ID, Consts.BACKENDLESS_SECRET_KEY, "v1");
public class NDevice implements Serializable {
@SerializedName(Consts.ANDROID_ID)
public String android_id;
@SerializedName(Consts.GCM_TOKEN)
public String gcm_token;
@SerializedName(Consts.MODEL)
public String model;
@SerializedName(Consts.DIGIT_ID)
public String digit_id;
private Boolean notEmpty;
private String objectId;
private java.util.Date created;
private java.util.Date updated;
public String getAndroid_id() {
return android_id;
}
public void setAndroid_id(String android_id) {
this.android_id = android_id;
}
public String getGcm_token() {
return gcm_token;
}
public void setGcm_token(String gcm_token) {
this.gcm_token = gcm_token;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getDigit_id() {
return digit_id;
}
public void setDigit_id(String digit_id) {
this.digit_id = digit_id;
}
public Boolean getNotEmpty() {
return notEmpty;
}
public void setNotEmpty(Boolean notEmpty) {
this.notEmpty = notEmpty;
}
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
}
private static void updateFields(BackendlessUser user) {
Object[] devicesObjectArray = (Object[]) user.getProperty(Consts.DEVICES);
if (devicesObjectArray != null && devicesObjectArray.length > 0) {
 NDevice[] devicesArray = (NDevice[]) devicesObjectArray;
 List<NDevice> deviceList = Arrays.asList(devicesArray);
 deviceList.add(NUser.i().device());
 NDevice[] devices = deviceList.toArray(new NDevice[deviceList.size()]);
 user.setProperty("devices", devices);
}
}
private void updateUser(BackendlessUser user) {
if (user != null) {
updateFields(user);
Backendless.UserService.update(user, new AsyncCallback<BackendlessUser>() {
public void handleResponse(BackendlessUser user) {
sendUserToFriendsAsync();
}
public void handleFault(BackendlessFault fault) {
NoteMessage.showAlert("update fault", fault.toString());
}
});
}
}

It will be more easy if I be able to save lists as json to BackendlessUser.
But backendless has limitation of string length (500 symbols) ((((
and relations not working properly ((

Hi Oleg,

Try to not convert List to array when setting it as a property:

private static void updateFields(BackendlessUser user) {
Object[] devicesObjectArray = (Object[]) user.getProperty(Consts.DEVICES);
if (devicesObjectArray != null && devicesObjectArray.length > 0) {
NDevice[] devicesArray = (NDevice[]) devicesObjectArray;
List<NDevice> deviceList = Arrays.asList(devicesArray);
deviceList.add(NUser.i().device());
user.setProperty("devices", devicesList);
}
}

And please tell whether it would work.

If I change it toList<NDevice> I have next error:
BackendlessFault{ code: ‘1155’, message: ‘Duplicate entry’ }

related problem:
http://support.backendless.com/t/cant-update-already-exists-object-related-with-backendlessuser

This should mean that the core problem is the one in related topic. So just use List instead of array when setting BackendlessUser property.

But we shall also investigate why setting array fails, thanks for reporting this.