JSON/SQL to Go
This extension helps convert JSON/SQL data from editor selection or clipboard to a Go struct.
This extension is built based on JSON to GO
Wake up the command palletet and input json2go
for json convert or sql2go
for sql convert
Common Settings
You can choose the input source of the JSON/SQL data.
If setting is <ask me every time>, you will be asked on every run of the command.
Also you will be asked to remember your choice, unless you select `No and don't ask again' in which case you will never be asked again to save your choice.
JSON Settings
You can choose inside which languages to show the context menu with the following setting.
Include "*"
if you want the context menu to always be shown.
Default values are below.
"json2go.contextMenu.supportedLanguages": [
"javascript",
"typescript",
"json",
"jsonc",
"html",
"go"
]
Inline type definitions
The checkbox allows you to generate nested types as inline structs:
type Autogenerated struct {
Employees []struct {
Name string `json:"name"`
Email string `json:"email"`
} `json:"employees"`
}
Or below the main struct:
type Autogenerated struct {
Employees []Employee `json:"employees"`
}
type Employee struct {
Name string `json:"name"`
Email string `json:"email"`
}
SQL Settings
//choose tags which you like to add, "gorm" is supported automatically
"sql2gorm.tags":["json","form","mapstructure"]