Problem with select2('data')

I use an extremely “complex” system for passing selected data to the server for elaboration.
The framework behind is xajax.
When I have to pass the “complete” selected option, with version 3.2 I used $(’#input_id’).select2(‘data’) and had no problems at all. With version 4.1.0-rc.0 I use the same function (…select2(‘data’) but I get an array with an object inside and the “prototype” definition, so xajax cannot parse as usual giving me an array/object and it give me a xml wich, server side, cannot be reconstructed. Since I don’t want to reing all xajax framework for this “stupid” problem, I think this solution could be excellent…

Inside

S2.define(‘jquery.select2’,[

I changed

    // Check if we should be returning `this`
    if (thisMethods.indexOf(options) > -1) {
      return this;
    }

    return ret;

with

    // Check if we should be returning `this`
    if (thisMethods.indexOf(options) > -1) {
      return this;
    }
    if (options == 'data' ){
    	new_ret = JSON.parse(JSON.stringify(ret));
    	return new_ret;
    }
    return ret;

Now I have an array of array but that’s easy to change my code for having only the 0 index…