protected function toJson(array $data, array $errors = [])
    {
        $response = ['data' => $data];
        if ($errors) {
            $response['fieldErrors'] = $errors;
        }

        return new JsonResponse($response, 200);
    }
protected function toJson(array $data, array $errors = [])
    {
        $response = ['data' => $data];
        if ($errors) {
            $response['fieldErrors'] = $errors;
        }

        return new JsonResponse($response, 200);
    }
protected function toJson ( array $ data , array $ errors = [ ] ) { $ response = [ 'data' => $ data ] ; if ( $ errors ) { $ response [ 'fieldErrors' ] = $ errors ; } return new JsonResponse ( $ response , 200 ) ; }
Display success data in dataTables editor format.

@param array $data
@param array $errors
@return JsonResponse
Display success data in dataTables editor format .