csv2json

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToJSON

func ConvertToJSON(data CSVData, header bool) ([]byte, error)

ConvertToJSON converts CSVData to JSON format, using headers if specified

func ParseCSVToStruct

func ParseCSVToStruct(csvData []byte, separator rune, result interface{}) error

ParseCSVToStruct parses CSV data from a byte slice and unmarshals it into the provided struct type

func ParseFileToStruct

func ParseFileToStruct(filePath string, separator rune, result interface{}) error

ParseFileToStruct parses CSV data from a file and unmarshals it into the provided struct type

Types

type CSVData

type CSVData [][]interface{}

func Parse

func Parse(csv []byte, separator rune) (CSVData, error)

Parse parses CSV data from a byte slice

func ParseFile

func ParseFile(path string, separator rune) (CSVData, error)

ParseFile parses CSV data from a file

func (CSVData) ToJSON

func (c CSVData) ToJSON(header bool) ([]byte, error)

Jump to

Keyboard shortcuts

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