Bonobo can be used to convert files from and to various data sources and file formats. You can use it from command line to convert a CSV file into JSON, or create a transformation if you need more flexibility or different transformation steps.
You do not need to know Python to use bonobo convert, only how to use a shell and have a shell where you can install python packages.
If you never used bonobo, you first need to install it. To know if bonobo is installed, you can run bonobo version (and it should be at least 0.5)
$ pip install bonobo
Simple as hell, just give the input and output file names to bonobo convert and you're good to go.
$ bonobo convert input.csv output.json
If bonobo can't detect your source file format (or your output does not end by .json), you can provide input format, output format, or both as optional arguments in the command line.
$ bonobo convert --reader csv input_file --writer json output_file
Or the shorthand version...
$ bonobo convert -r csv input_file -w json output_file
Writing a transformation is easy. Here is an equivalent transformation to the command line example above.
Create a convert_csv_to_json.py file, and paste the following code:
graph = bonobo.Graph(
if __name__ == '__main__':
Now, you can use bonobo run to execute it.
$ bonobo run convert_csv_to_json.py
If you're ready to go further and learn what you can do between the read and write phases, go ahead and read the 10 minutes to bonobo tutorial.