csv2ndjson-lite

Crates.iocsv2ndjson-lite
lib.rscsv2ndjson-lite
version0.2.0
sourcesrc
created_at2020-12-12 11:22:22.823292
updated_at2021-05-30 10:01:44.226889
descriptionA little tool to convert a csv to a valid ndjson/json-stream
homepage
repositoryhttps://github.com/Kerollmops/csv2ndjson-lite
max_upload_size
id322143
size12,237
LV2 Maintainers (github:rustaudio:lv2-maintainers)

documentation

README

csv2ndjson-lite

A little tool to convert a csv to a valid ndjson/json-stream (supported comma separated arrays).

Installation

You can use cargo to install this tool:

cargo install -f csv2ndjson-lite

Usage

Here is an example CSV file, note that there is fields that are comma separated.

title,genres,scores,duration
Carmencita,"Documentary,Short","23,25,56",3.5
Miss Jerry,Romance,"3,2,6",5.3
Corbett and Courtney Before the Kinetograph,"Short,Sport","203,250,506",

If you want to output an array when CSV values are comma separated, specify those headers as arguments.

cat mydata.csv | csv2ndjson-lite --arrays genres scores --numbers scores duration

The output of the previous command would be something like so.

{"title":"Carmencita","genres":["Documentary","Short"],"scores":[23,25,56],"duration":3.5}
{"title":"Miss Jerry","genres":["Romance"],"scores":[3,6],"duration":5.3}
{"title":"Corbett and Courtney Before the Kinetograph","genres":["Short","Sport"],"scores":[203,250]}
Commit count: 6

cargo fmt