Skip to content

Unsupported JSON structure. #15

@orhan-cmd

Description

@orhan-cmd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions