src/DataExport/Format/Json.php
public function execute($oSourceResponse, $rFile)
    {
        fwrite($rFile, '[');

        //  Write the data to the file
        while ($oRow = $oSourceResponse->getNextItem()) {
            fwrite($rFile, trim(json_encode($oRow) . ','));
        }

        $aStats = fstat($rFile);
        $aStats = array_slice($aStats, 13);
        if ($aStats['size'] > 1) {
            ftruncate($rFile, $aStats['size'] - 1);
            fseek($rFile, $aStats['size'] - 1);
        }

        fwrite($rFile, ']');
    }
public function execute($oSourceResponse, $rFile)
    {
        fwrite($rFile, '[');

        //  Write the data to the file
        while ($oRow = $oSourceResponse->getNextItem()) {
            fwrite($rFile, trim(json_encode($oRow) . ','));
        }

        $aStats = fstat($rFile);
        $aStats = array_slice($aStats, 13);
        if ($aStats['size'] > 1) {
            ftruncate($rFile, $aStats['size'] - 1);
            fseek($rFile, $aStats['size'] - 1);
        }

        fwrite($rFile, ']');
    }
Takes a SourceResponse object and transforms it into the appropriate format.

@param SourceResponse $oSourceResponse A SourceResponse object
@param resource       $rFile           The file resource to write to