Save a CSV file as JSON in PHP
API
POST
https://api.aspose.cloud/v3.0/cells/{name}/SaveAs
Saving file formats from CSV as JSON is a complex task. All CSV to JSON format transitions is performed by our PHP SDK while maintaining the source CSV spreadsheet's main structural and logical content. Our PHP library is a professional solution to save CSV as JSON files online. This Cloud SDK gives PHP developers powerful functionality and perfect JSON output.
PHP Code Example for saving CSV as JSON using REST API
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-php/
$apiInstance = new CellsApi( getenv("ProductClientId"),getenv("ProductClientSecret") );
$name ='Book1.csv';
$saveOptions =new \Aspose\Cells\Cloud\Model\SaveOptions();
$saveOptions->SaveFormat = "json";
$newfilename = "Book1Saveas.json";
$isAutoFitRows= 'true';
$isAutoFitColumns= 'true';
$folder = "Temp";
$result = $apiInstance->cellsSaveAsPostDocumentSaveAs($name, $saveOptions, $newfilename,$isAutoFitRows, $isAutoFitColumns, $folder);
How to save CSV as JSON using the Cells Cloud PHP library.
- Register an account at Dashboard to get free API quota & authorization details
- Install PHP library and add the reference (import the library) to your project.
- Open the source file in PHP.
- Use the `PostWorkbookSaveAs` method to retrieve the resulting stream.
System Requirements
- PHP 7.4 or newer