Google Charts JSON wrongly sorted

Hi guys and gals, We've run into an issue where, when using the Google Charts widget, the columns get wrongly sorted, causing the data to be displayed incorrectly. We create the entities in the right order in the Microflow, however, it seems that the JSON serializer does something with the data, causing it to sort wrongly, and having the wrong column first (to the X column will be shown as the Y column and vice versa ) We've seen an issue regarding the JSON Serializer in the rest module and the fact that reference sets weren't sorted correctly, but this issue should've been resolved quite some time ago. Example: Graphs.StringValue (ID: 23362423066986750) Graphs.IntegerValue (ID: 13229323905403134) We think that, because of the sorting in the JSON Serializer, the IntegerValue is processed first, causing it to be at the top of the JSON, causing the wrong graph. Does anyone have a solution for our problem, or someone who ran in to the same issue? We have no idea what could be the true cause of this, and what could be our solution... Thanks!
3 answers

So we finally found out was was causing the issue: the use of inheritence messes with the IDs. That in combination with the ID sorting was causing the problem we experienced.

The issue was mentioned somewhere on the restServices github page. I'll make sure to file a formal bugreport for this.

Thanks for all your input!


Hi Nick and Chris,

First of all, thank you for your answers. I'll try to give an as complete answer as possible.

We actually don't use a sorting attribute. How would we do that, using the JSON serializer? The easiest way to show you is by modelshare. Brief explanation:

The user is able to select what the timeframe is for the graph (day, week, month, year). This is known as Filter. Based on the filter the data is later aggregated to the correct timeframe. After all the data is collected it is added ( through assocation) to the highest entity, and that is passed to the JSON Serializer.

So the actual problem is that the JSON serializer mixes up the columns, where the X-axis becomes the Y-axis and vice versa. We have one database (local) which works correctly, and another database (cloud backup) which doesn't. That's why we think it's an ID issue. Howver, we don't actually supply an ID, so how would we use that ID as a string and tell the JSON Serializer to use that one instead of the Int?

<iframe width="100%" height="491px" frameborder="0" src=""></iframe>

ModelShare Link


Hi Paul, If I have a quick look into restservices.util.JsonSerializer, I find the following;

 * Referenceset
else if (member instanceof MendixObjectReferenceSet){
    JSONArray ar = new JSONArray();
    if (value != null) {
        List<IMendixIdentifier> ids = (List<IMendixIdentifier>) value;
        for(IMendixIdentifier id : ids) if (id != null) {
            Object url = identifierToJSON(context, id, alreadySeen, useServiceUrls);
            if (url != null)
    target.put(targetMemberName, ar);           

I'm not too sure about why the Utils.sortIdList() is used and which does what it says. Perhaps you can file an issue at GitHub

Really curious about the solution to this issue.