json to go struct converter
Find a file
2024-10-11 22:25:04 -06:00
.gitignore Initial commit 2024-10-11 21:18:53 -06:00
json2go update to make sure it matches outputs of Matt Holts JSON-to-Go site 2024-10-11 22:25:04 -06:00
LICENSE Initial commit 2024-10-11 21:18:53 -06:00
README.md update to make sure it matches outputs of Matt Holts JSON-to-Go site 2024-10-11 22:25:04 -06:00

json2go

json to go struct converter

Command

usage: json2go [-h] [-i INPUT] [-b BUFFER] [-n NAME] [-o]

convert json to go structs

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        file: <file.json> or stdin: -
  -b BUFFER, --buffer BUFFER
                        indent text
  -n NAME, --name NAME  struct name
  -o, --omit            add omitempty

thanks for using json2go!

Usage

Read from file

json2go -i test.json

Read from stdin

cat test.json | json2go -i -
json2go -i $(echo test.json)

Change indentation string

json2go -i test.json -b "  "

Name the struct instead of the default AutoGenerated

json2go -i test.json -n TestStruct

Add omitempty tags to the json output

json2go -i test.json -o