Skip to content
/ csvconv Public

A Go library for converting other encodings to and from CSVs

Notifications You must be signed in to change notification settings

yhat/csvconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

csvconv

A Go library for converting CSVs to other encodings and back.

Usage

package main

import (
	"fmt"
	"strings"

	"github.com/yhat/csvconv"
)

var csvData = `a,b,c
1,2,3
4,5,6`

func main() {
	r := csvconv.NewReader(strings.NewReader(csvData), ',')
	rowsRead, jsonData, err := r.ToJSON(csvconv.OrientColumns, -1)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println("Read", rowsRead, "rows")
	fmt.Printf("%s\n", jsonData)
}

Output:

Read 2 rows
{"a":[1,4],"b":[2,5],"c":[3,6]}

About

A Go library for converting other encodings to and from CSVs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages