Giter Site home page Giter Site logo

json2csv's People

Contributors

dolmen avatar yukithm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

json2csv's Issues

Unsupported JSON structure.

I tried converting JSON('string not struct') to CSV but got an Unsupported JSON structure. error
unknown

package main

import (
	"github.com/yukithm/json2csv"
)

func main() {
	as := `[
  {
    "id": 1,
    "name": "foo",
    "favorites": {
      "fruits": "apple",
      "color": "red"
    }
  },
  {
    "id": 2,
    "name": "bar",
    "favorites": {
      "fruits": "orange"
    }
  },
  {
    "id": 3,
    "name": "baz",
    "favorites": {
      "fruits": "banana",
      "color": "yellow"
    }
  }
]`
	csv, err := json2csv.JSON2CSV(as)
	if err != nil {
		return
	}
	println(csv)
}

cannot instal using go get

Hi,
I'm trying to install the tool using go get method, but am getting an error:

21-02-03 18:44 % go get github.com/yukithm/json2csv/cmd/json2csv
# github.com/yukithm/json2csv/cmd/json2csv
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:68:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:73:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:77:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
	cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:91:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:105:29: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:106:36: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
  • go version go1.15.7 darwin/amd64
  • macOS Big Sure 11.2

Non-ASCII

Hey, I had problems with tool converting Arabic texts from JSON to CSV.

Improved support as replacement for npm-based json2csv

I'm looking for a go-based replacement of the npm-based json2csv but there are some features missing that still require some pre-processing of data before it can be fed into this go-based implementation:

  • Support arrays of objects as input, not only line-delimited JSON
  • Make it possible to output all keys found in the data without having to specify each key
  • Specify a quote value (see "-q") to quote fields with

There are more functionality that may be added but these are the most important ones that prevent me from switching.
It would be great to add support for them (and maybe others) so a switch of the implementations is easier to do.

Use other styles when using the library in the code

I am trying to set a different style, however, I can't seem to know how to do that. I wonder if that is just not available or if I can do that somehow

I new a newCSVWriter that uses SlashStyle style.

Thanks for the awesome tool

Seems that WriteCSV is losing some of its data

I have noticed that some conversion (can't figure it out the pattern that is causing it) lose its data when converting the content to the csv file.

Steps to reproduce:

b := &bytes.Buffer{}
wr := json2csv.NewCSVWriter(b)
responses := []map[string]interface{}{} 

//populate responses

csvContent, err := json2csv.JSON2CSV(responses) // csvContent seems to be complete!
wr.WriteCSV(csvContent) 
wr.Flush()
b.Bytes()

At this point when I print the string of the bytes, I get 2 columns missing.

Seems that the issue happens here:
image

Which doesn't make sense because the value is there
image
image

Issue when running go get

$ go get github.com/yukithm/json2csv/cmd/json2csv
# github.com/yukithm/json2csv/cmd/json2csv
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:68:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:73:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:77:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
	cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:91:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:105:29: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
go/src/github.com/yukithm/json2csv/cmd/json2csv/main.go:106:36: invalid operation: c.Args()[0] (type cli.Args does not support indexing)

please release to homebrew or docker hub

I'm trying to download and run the binary file, but macOS prevents it, because cannot verify it

Could you please release the binary file to the homebrew or to the Docker Hub?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.