csv2json

module
v0.0.0-...-c04c0c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2019 License: MIT

README

Tools to convert CSV and JSON

csv2json

  • Reads CSV records from standard in.
  • Outputs a JSON array of map entries to standard out.
  • Assumes the first CSV record is the header.
Get it
 go get -u bitbucket.org/BjoernSchilberg/csv2json/cmd/csv2json

Place the resulting csv2json in your $PATH.

Use it
csv2json < file.csv > file.json
Format the output
cat file.csv | ./csv2json -p
Testing with real data

Real data for testing is for e.g. available from the USGS Earthquake Hazards Program as CSV.

curl http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv | csv2json > all_month.json

json2csv

  • Reads JSON array structure from standard in or optional an JSON object whichs holds the JSON array structure
  • Outputs a CSV to standard out.
Get it
go get -u bitbucket.org/BjoernSchilberg/csv2json/cmd/json2csv

Place the resulting json2csv in your $PATH.

Use it
json2csv -h
json2csv < file.json > file.csv
json2csv -array=false --object=observations < file.json > file.csv

csv2xlsx

  • Reads CSV records from standard in.
  • Outputs a xlsx to standard out.
  • Assumes the first CSV record is the header.
Get it
go get -u bitbucket.org/BjoernSchilberg/csv2json/cmd/csv2xlsx

Place the resulting csv2xlsx in your $PATH.

Use it
csv2xlsx -h
csv2xlsx < file.csv > file.xlsx
csv2xlsx -sheet=observations < file.csv > file.xlsx

json2xlsx

  • Reads JSON array structure from standard in or optional an JSON object whichs holds the JSON array structure
  • Outputs a XLSX to standard out.
Get it
go get -u bitbucket.org/BjoernSchilberg/csv2json/cmd/json2xlsx

Place the resulting json2xlsx in your $PATH.

Use it
jsonxlsx -h
json2xlsx < file.csv > file.xlsx
json2xlsx -sheet=observations -array=false -object=observations < file.csv > file.xlsx

License

This is Free Software under the terms of the MIT license. See LICENSE file for details. (c) 2016-2019 by Bjoern Schilberg

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL