I have a custom business logic method:
public List<Membership> getMemberships() {
StringBuilder whereClause = new StringBuilder();
whereClause.append("user.objectId='").append(InvocationContext.getUserId()).append("'");
BackendlessDataQuery dataQuery = new BackendlessDataQuery();
dataQuery.setWhereClause(whereClause.toString());
List<Membership> result = Backendless.Persistence.of(Membership.class).find(dataQuery).getCurrentPage();
return result;
which looks fine and returns data, 2 memberships with the current database content. The database content looks fine, but the JSON has an error in it. The memberships have a relation to a Business, and each Business has a relationship to all the Memberships. So in this example 1 user is querying to find out what business they are in and who else is in that business.
The first business in the JSON is fine, it contains an object with "___objectref": 1
in the list of memberships and everything works nicely. The second business however contains an array of strings where there should be an array of objects like the first business has. The single string in the array appears to be a datestamp "1458304017000"
but that’s just a guess. It certainly seems to have nothing to do with the membership that should actually be in the array.
The returned JSON is:
[
{
"___jsonclass": "Membership",
"business": {
"___jsonclass": "Business",
"created": "1458304017000",
"ownerId": null,
"members": [
{
"___objectref": 1
}
],
"___class": "Business",
"updated": null,
"objectId": "58E47B88-5E12-1C5D-FF14-E9887EC5AB00",
"___dates___": [
"1458304017000"
]
},
"created": "1458304017000",
"ownerId": null,
"___class": "Membership",
"updated": null,
"objectId": "6191CFF7-DF43-C697-FF6E-C131E1851000",
"___dates___": [
"1458303983000",
"1458304017000"
]
},
{
"___jsonclass": "Membership",
"business": {
"___jsonclass": "Business",
"created": "1458073011000",
"ownerId": null,
"members": [
[
"1458304017000"
]
],
"___class": "Business",
"updated": null,
"objectId": "0F82D274-F114-2169-FFC9-89EAAF443900",
"___dates___": [
"1458073011000"
]
},
"created": "1458073011000",
"ownerId": null,
"___class": "Membership",
"updated": null,
"user": null,
"objectId": "48BEB1F3-3B3C-5A90-FFD8-78F2951D9500",
"___dates___": [
"1458072980000",
"1458073011000"
]
}
]
That was collected from running in debug with CodeRunner. I’ve just noticed a new version has been released a few days ago so I’ll download that and give it a try too.