Convert json string to Golang struct

json-to-go-cli

Convert json string to Golang struct

How to install

git clone https://github.com/tiancheng92/json-to-go-cli.git
cd json-to-go-cli
go build
mv json-to-go-cli ~/your/PATH/directory

How to use

  • Nested

    json-to-go-cli -ns '{"abc":"2021-09-15T13:22:32.768+08:00","d":1,"e":1.1,"f":12312312312312,"g":null,"h":[],"i":{"123":321}}'

    output

    type AutoGenerated struct {
            Abc time.Time `json:"abc"`
            D int `json:"d"`
            E float64 `json:"e"`
            F int64 `json:"f"`
            G interface{} `json:"g"`
            H []interface{} `json:"h"`
            I struct {
                    Num123 int `json:"123"`
            } `json:"i"`
    }
  • Spread

    json-to-go-cli -s '{"abc":"2021-09-15T13:22:32.768+08:00","d":1,"e":1.1,"f":12312312312312,"g":null,"h":[],"i":{"123":321}}'

    output

    type AutoGenerated struct {
            Abc time.Time `json:"abc"`
            D int `json:"d"`
            E float64 `json:"e"`
            F int64 `json:"f"`
            G interface{} `json:"g"`
            H []interface{} `json:"h"`
            I I `json:"i"`
    }
    type I struct {
            Num123 int `json:"123"`
    }
Similar Resources

A memory-efficient trie for testing the existence/prefixes of string only(for now).

Succinct Trie A memory-efficient trie for testing the existence/prefixes of string only(for now). Install go get -u github.com/nobekanai/sutrie Docume

Mar 10, 2022

Convert Go values to their AST

valast - convert Go values to their AST Valast converts Go values at runtime into their go/ast equivalent,

Dec 21, 2022

A faster method to get elements from an interface (Struct or Slice type) for Go.

A faster method to get elements from an interface (Struct or Slice type) for Go.

May 13, 2022

An interesting go struct tag expression syntax for field validation, etc.

An interesting go struct tag expression syntax for field validation, etc.

Jan 8, 2023

GoStruct2Table - format your struct like a table.

GoStruct2Table format your struct like a table. Installing $ go get -u -v github.com/runningzyp/GoStruct2Table Simple Example import parser "github.c

Aug 15, 2022

Nullable Go types that can be marshalled/unmarshalled to/from JSON.

Nullable Go types Description This package provides nullable Go types for bool, float64, int64, int32, string and time.Time replacing sql.NullString,

Dec 12, 2022

Generates data structure definitions from JSON files for any kind of programming language

Overview Archivist generates data structure definitions from JSON files for any kind of programming language. It also provides a library for golang to

Jun 28, 2022

Dasel - Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool.

Dasel - Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool.

Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package.

Jan 1, 2023
Recursively searches a map[string]interface{} structure for another map[string]interface{} structure

msirecurse Recursively searches a map[string]interface{} structure for existence of a map[string]interface{} structure Motivation I wrote this package

Mar 3, 2022
💯 Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

Package validator implements value validations for structs and individual fields based on tags.

Nov 9, 2022
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages.

mxj - to/from maps, XML and JSON Decode/encode XML to/from map[string]interface{} (or JSON) values, and extract/modify values from maps by key or key-

Dec 22, 2022
Golang string comparison and edit distance algorithms library, featuring : Levenshtein, LCS, Hamming, Damerau levenshtein (OSA and Adjacent transpositions algorithms), Jaro-Winkler, Cosine, etc...

Go-edlib : Edit distance and string comparison library Golang string comparison and edit distance algorithms library featuring : Levenshtein, LCS, Ham

Dec 20, 2022
An in-memory string-interface{} map with various expiration options for golang

TTLCache - an in-memory cache with expiration TTLCache is a simple key/value cache in golang with the following functions: Expiration of items based o

Jan 8, 2023
An in-memory string-interface{} map with various expiration options for golang

TTLCache - an in-memory cache with expiration TTLCache is a simple key/value cache in golang with the following functions: Expiration of items based o

Dec 28, 2022
Multi-String Pattern Matching Algorithm Using TrieHashNode

Multi-String Pattern Matching algorithm. This implementation is inspired from Aho-Corasick algorithm Getting Started modelA = mspm.NewModel("mspm_mode

Dec 9, 2022
Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching.

Trie Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching. Usage Create a Trie with: t := trie.New() Add Keys with:

Dec 27, 2022
Implementation of Boyer-Moore fast string search algorithm in Go

boyermoore Implementation of Boyer-Moore fast string search algorithm in Go

Oct 7, 2022
A fast (5x) string keyed read-only map for Go - particularly good for keys using a small set of nearby runes.

faststringmap faststringmap is a fast read-only string keyed map for Go (golang). For our use case it is approximately 5 times faster than using Go's

Jan 8, 2023