json2go

package module
v0.0.0-...-c186027 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: MPL-2.0 Imports: 8 Imported by: 1

README

JSON-2-Go

Pipelinecodecov

This tool converts JSON into a Go type definition. This is a Go implementation of Matt Holt's JSON-to-Go.

Installation

This project is hosted on gitlab and mirrored to github

go get -u gitlab.com/ahmedalhulaibi/json2go/...

Usage

curl http://api.open-notify.org/astros.json -s | json2go-cli --typename Astronaut

type Astronaut struct {
	Message string `json:"message"`
	Number  int    `json:"number"`
	People  []struct {
		Craft string `json:"craft"`
		Name  string `json:"name"`
	} `json:"people"`
}


Nested JSON objects are resolved to inline type definitions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonToGo

func JsonToGo(jsonString []byte, typename string) ([]byte, error)

Types

type TemplateData

type TemplateData struct {
	Typename string
	JsonMap  map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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