jcgo

module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT

README

jcgo

Go GoDoc Go Report Card Go Version codecov

Description

JSON to CSV converter in Golang.

Note: at this time, this converter doesn't implement the full JSON spec. (it doesn't currently handle arrays of scalar values, only arrays of map[string]interface{})

Usage

jcgo reads JSON from the file specified as a command line argument, parses the JSON, and writes the data to a CSV file.

> git clone https://github.com/ecshreve/jcgo.git
> cd jcgo
> make build
> bin/jcgo jsontestlocal.json jsontestlocal.output.csv
2020/07/24 18:39:22 generated csv file: jsontestlocal.output.csv

> cat jsontestlocal.output.csv | column -t -s ,
afterState_arrivedAt  afterState_departureTimeMs  afterState_destinationName  afterState_id  afterState_jobState  beforeState_arrivedAt  beforeState_departureTimeMs  beforeState_destinationName  beforeState_id  beforeState_jobState  changedAtMs    events_eventAt  events_eventType  id
0                     0                           CARI307                     4337769816     4                    0                      0                            CARI307                      4337769816      4                     1591056576414  1591056576414   0                 4333023554
1591034132029         1591034209011               JASON077                    4337769817     3                    1591034132029          1591034209011                JASON077                     4337769817      3                     1591056576414  1591056576414   0                 4333023554

reference

Googling

Here's an abbreviated list of the things I googled while making this (in no particular order).

  • json to csv
  • arbitrary json to csv
  • parse json golang
  • parse nested json
  • json to csv golang github
  • json spec
  • graphql json results
  • write to csv golang
  • golang parse command line args
  • golang flag package
  • golang use flags in test
  • longest common prefix
  • golang module
  • golang project organization
  • golang remove dependencies from module
  • go install vs go build
  • godoc json
  • godoc csv
  • golang stringer
  • golang interface inheritance
  • golang init function
  • golang sort custom type
  • golang embedded struct ... and many, many more

Directories

Path Synopsis
cmd
internal
object
Package object provides implementations of the Object interface for the possible JSON input value types.
Package object provides implementations of the Object interface for the possible JSON input value types.
pkg
parser
Package parser provides implementation of a Parser that converts a JSON file to a CSV file.
Package parser provides implementation of a Parser that converts a JSON file to a CSV file.

Jump to

Keyboard shortcuts

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