Question on using Gridconnector/dataprocessor in JSON mode

I’m not able to figure how to use the grid dataprocessor to use json instead of html.

This is my grid initialization code:

      avgGrid = avLayout.cells("a").attachGrid();// list all averages in grid
       with(avgGrid){
        setHeader("Average");
        setColAlign("left");
        setColTypes("ed");
        setColSorting("str");
       };
        var dpav = new dataProcessor("controller.php/listavg"); //data processor setup for averages grid
        dpav.action_param = "dhx_editor_status"; 
        dpav.init(avgGrid);
        dpav.setTransactionMode("JSON");
        avgGrid.init();
        avgGrid.load("controller.php/listavg");

The controller coder is as follows:

$conn = new GridConnector($mysqli, "MySQLi"); 


if(isset($urlParts[1]) && $urlParts[1]=="listavg"){ //datavalue grid request
    $conn->configure("dummy", "id", "avgname");
    $conn->useModel(new AvgListModel());
    $conn->render();
};

The model is

class AvgListModel{
    function get($request){
        global $account;
        foreach($account->averages as $avgId => $avgArr){
            $data[] =  array("id"=> $avgId, "avgname" => $avgArr['name']);
        };
        return $data;
    }
    
}

The grid is rendered perfectly but the format used is XML for data transmission. How should I change the code to switch it to JSON instead of xml for this configuration?

Any suggestion guys ?

The dpav.setTransactionMode(“JSON”); line changes the mode of components, so during data modification component will send serialized json as a value of all data saving calls. It can be used for custom backend but has no sense when you are using connectors on the server side, as server side connector expects incoming data in the default ( url-encoded ) format.