defuncart / json_to_csv

A tool to convert multiple json files to csv.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

json_to_csv

A tool to convert multiple json files to csv.

Getting Started

Given json files of the form

{
    "helloWorld": "Hello World!"
}
{
    "helloWorld": "Hallo Welt!"
}

a csv file

key;en;de;
helloWorld;Hello World!;Hallo Welt!;

is generated.

Note that the column headers en, de are automatically inferred from json basename.

Add dependency

Firstly, add the package as a dev dependency:

dev_dependencies: 
  json_to_csv:

Define Settings

Next define arb_generator package settings in pubspec.yaml.

json_to_csv:
  files_path: 'assets/json/'
  main_file: 'assets/json/en.json'
  output_file: 'assets/test.csv'
  csv_delimiter: ';'
Setting Description
files_path A path to folder containing json files.
main_file A path to folder containing main json file (i.e. en.json).
output_file A path to save the generated csv file.
csv_delimiter A delimiter to separate columns in the input CSV file. Defaults to ;.

Run package

Ensure that your current working directory is the project root. Depending on your project, run one of the following commands:

dart run json_to_csv

or

flutter pub run json_to_csv

Collaboration

Spotted any issues? Please open an issue on GitHub! Would like to contribute a new language or feature? Fork the repo and submit a PR!

About

A tool to convert multiple json files to csv.

License:MIT License


Languages

Language:Dart 100.0%