json2csv icon indicating copy to clipboard operation
json2csv copied to clipboard

Unsupported JSON structure.

Open orhan-cmd opened this issue 3 years ago • 0 comments

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)
}

orhan-cmd avatar Aug 10 '22 07:08 orhan-cmd