Online tool that convert JSON to Go.

json-to-go

将json生成go的数据结构。Online tool that convert JSON to Go.

Online Link | 地址

Local Develope | 本地开发

suggest use(强烈建议使用) pnpm !!!

  • install pnpm install

  • dev pnpm dev

  • build pnpm build

custom tag | 自定义tag

  • format | 格式

   
    :[name method]:[is add omitempty]

    
     :[命名方式]:[是否添加omitempty]

    
   
  • name method | 命名方式
  1. original | 原样返回
  2. abcDef | 小驼峰 - 默认
  3. AbcDef | 大驼峰
  4. abc_def | 下划线
  5. Abcdef | 只有第一个字母大写
  6. abcdef | 全都小写
  • examples | 例子

json

form

json:1:true

json:3:false,form:2:true,query:1:false

Features | 特征

  • custom tag | 支持自定义tag
  • custom root object name | 支持自定义根对象名
  • support inline | 支持内联结构
  • support edit | 支持编辑
  • json syntax extension | 对json语法进行了扩展,支持不规范的json
  • json check/format/compress | 支持不规范的json的纠正、格式化、压缩

Reference | 参考

Similar Resources

A tool to aggregate and mine data from JSON reports of Go tests.

teststat A tool to aggregate and mine data from JSON reports of Go tests. Why? Mature Go projects often have a lot of tests, and not all of them are i

Sep 15, 2022

Abstract JSON for golang with JSONPath support

Abstract JSON Abstract JSON is a small golang package provides a parser for JSON with support of JSONPath, in case when you are not sure in its struct

Jan 5, 2023

Fast JSON parser and validator for Go. No custom structs, no code generation, no reflection

fastjson - fast JSON parser and validator for Go Features Fast. As usual, up to 15x faster than the standard encoding/json. See benchmarks. Parses arb

Jan 5, 2023

Small utility to create JSON objects

Small utility to create JSON objects

gjo Small utility to create JSON objects. This was inspired by jpmens/jo. Support OS Mac Linux Windows Requirements Go 1.1.14~ Git Installtion Build $

Dec 8, 2022

A Go package for handling common HTTP JSON responses.

go-respond A Go package for handling common HTTP JSON responses. Installation go get github.com/nicklaw5/go-respond Usage The goal of go-respond is to

Sep 26, 2022

JSON query in Golang

gojq JSON query in Golang. Install go get -u github.com/elgs/gojq This library serves three purposes: makes parsing JSON configuration file much easie

Dec 28, 2022

Automatically generate Go (golang) struct definitions from example JSON

gojson gojson generates go struct definitions from json or yaml documents. Example $ curl -s https://api.github.com/repos/chimeracoder/gojson | gojson

Jan 1, 2023

A JSON diff utility

JayDiff A JSON diff utility. Install Downloading the compiled binary Download the latest version of the binary: releases extract the archive and place

Dec 11, 2022

Fast and flexible JSON encoder for Go

Fast and flexible JSON encoder for Go

Jettison Jettison is a fast and flexible JSON encoder for the Go programming language, inspired by bet365/jingo, with a richer features set, aiming at

Dec 21, 2022
Comments
  • 根据整数范围限制对映射类型做调整

    根据整数范围限制对映射类型做调整

    const (
    	MaxInt8   = 1<<7 - 1
    	MinInt8   = -1 << 7
    	MaxInt16  = 1<<15 - 1
    	MinInt16  = -1 << 15
    	MaxInt32  = 1<<31 - 1
    	MinInt32  = -1 << 31
    	MaxInt64  = 1<<63 - 1
    	MinInt64  = -1 << 63
    	MaxUint8  = 1<<8 - 1
    	MaxUint16 = 1<<16 - 1
    	MaxUint32 = 1<<32 - 1
    	MaxUint64 = 1<<64 - 1
    )
    
  • [BUG]多维数组转换错误

    [BUG]多维数组转换错误

    Original Data

    {
        "a": 123,
        "b": "xxx",
        "c": [
            [
                1,
                2,
                3
            ],
            [
                1,
                null,
                3
            ]
        ]
    }
    

    Result

    type RootObject struct {
        A int           `json:"a"`
        B string        `json:"b"`
        C []interface{} `json:"c"`
    }
    

    Expect

    type RootObject struct {
        A int           `json:"a"`
        B string        `json:"b"`
        C [][]interface{} `json:"c"`
    }
    
  • 对于key是数字类型的转换思考

    对于key是数字类型的转换思考

    {
        "a": -1231.323,
        "b": {
            "z": 31,
            "p": true,
            "123": "key是字符串"
        }
    }
    

    下面哪种转换比较合理呢......

    type RootObject struct {
        A float64                `json:"a"`
        B map[string]interface{} `json:"b"`
    }
    
    type RootObject struct {
        A float64 `json:"a"`
        B B       `json:"b"`
    }
    type B struct {
        Z           int    `json:"z"`
        P           bool   `json:"p"`
        NumberField string `json:"123"`
    }
    
  • 结构相同问题

    结构相同问题

    • 同结构,属性类型不同
    {
        "aaa": {
            "bbb": {
                "a": 123
            }
        },
        "bbb": {
            "a": true
        }
    }
    
    • 同结构,属性不同
    {
        "aaa": {
            "bbb": {
                "a": 123
            }
        },
        "bbb": {
            "b": true
        }
    }
    
    • 深层次嵌套同结构
convert JSON of a specific format to a type structure(Typescript type or more)

json2type convert JSON of a specific format to a type structure(Typescript type or more) Quick Start CLI Install use go tool install go install github

Mar 28, 2022
Convert JSON string to Graphql

Convert JSON in string type (example below) to GraphQL Input in GolangConvert JSON in string type (example below) to GraphQL Input in Golang

Oct 5, 2021
Devto-json2md - Convert the dev.to blog JSON export into Markdown files

devto-json2md Convert dev.to blog JSON export into Markdown files Features Exports Markdown compatible files using Hugo-compatible front-matter fields

Jan 8, 2022
Get JSON values quickly - JSON parser for Go
Get JSON values quickly - JSON parser for Go

get json values quickly GJSON is a Go package that provides a fast and simple way to get values from a json document. It has features such as one line

Dec 28, 2022
JSON diff library for Go based on RFC6902 (JSON Patch)

jsondiff jsondiff is a Go package for computing the diff between two JSON documents as a series of RFC6902 (JSON Patch) operations, which is particula

Dec 4, 2022
Fast JSON encoder/decoder compatible with encoding/json for Go
Fast JSON encoder/decoder compatible with encoding/json for Go

Fast JSON encoder/decoder compatible with encoding/json for Go

Jan 6, 2023
Package json implements encoding and decoding of JSON as defined in RFC 7159

Package json implements encoding and decoding of JSON as defined in RFC 7159. The mapping between JSON and Go values is described in the documentation for the Marshal and Unmarshal functions

Jun 26, 2022
JSON Spanner - A Go package that provides a fast and simple way to filter or transform a json document

JSON SPANNER JSON Spanner is a Go package that provides a fast and simple way to

Sep 14, 2022
CLI tool to handle JSON logs

logit is a CLI tool that consumes logs in JSON and feeds them into a logs storage like file, Amazon CloudWatch, or Slack.

Sep 28, 2022
/ˈdʏf/ - diff tool for YAML files, and sometimes JSON
/ˈdʏf/ - diff tool for YAML files, and sometimes JSON

dyff is inspired by the way the old BOSH v1 deployment output reported changes from one version to another by only showing the parts of a YAML file that change.

Dec 29, 2022