Categorygithub.com/yudppp/json2struct
modulepackage
2.0.0+incompatible
Repository: https://github.com/yudppp/json2struct.git
Documentation: pkg.go.dev

# README

json2struct

Translate to Golang struct from json

Playground

Try playground https://yudppp.github.io/json2struct

CLI

Install

$ go get github.com/yudppp/json2struct/cmd/json2struct

How to use

$ echo '{"url": "http://blog.yudppp.com", "text": "Hello:)", "status": 1, "categories": [{"name": "k8s"}]}' |  json2struct -name=blog
type Blog struct {
	Categories []BlogCategory `json:"categories"`
	Status     int            `json:"status"`
	Text       string         `json:"text"`
	URL        string         `json:"url"`
}

type BlogCategory struct {
	Name string `json:"name"`
}

options

optiondescription
nameSet struct name (default "data")
prefixSet struct name prefix
suffixSet struct name suffix
shortSet short struct name mode
localUse local struct mode
omitemptySet omitempty mode
exampleUse example tag (https://github.com/yudppp/structs)

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author