You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a new converter to convert a tabular data into a JSON stream.
Proposed API
useLeague\Csv\JsonConverter;
$converter = JsonConverter::create(); ///returns a new converter with default options that match those of json_encode$converter->convert(iterable $tabularData): Iterator; //returns an Iterator<string> object foreach ($converter->convert($tabularData) as$line) {
echo$line;
}
//lazyly generates the JSON data$converter->save(iterable $tabularData, mixed $destination): void;
// This methods uses the `convert` method internally to store the generated data to the filepath located at detination.$converter->save(Reader::createFromPath('document.csv'), 'document.json');
//will convert the CSV into a JSON string and store the result in document.json
The class can be configured with the following methods:
They all more or less map to json_encode parameters except for the indentSize method that enable creating JSON string in pretty print mode with different indentation size. By default the method uses and indentSize of 4 characters.
``
The text was updated successfully, but these errors were encountered:
Feature Request
Proposal
Adding a new converter to convert a tabular data into a JSON stream.
Proposed API
The class can be configured with the following methods:
They all more or less map to
json_encode
parameters except for theindentSize
method that enable creating JSON string in pretty print mode with different indentation size. By default the method uses and indentSize of 4 characters.``
The text was updated successfully, but these errors were encountered: