An open API service indexing awesome lists of open source software.

https://github.com/mayur-tolexo/j2s

Golang code generator for creating struct from json.
https://github.com/mayur-tolexo/j2s

generate-code go json json2struct struct template

Last synced: about 1 month ago
JSON representation

Golang code generator for creating struct from json.

Awesome Lists containing this project

README

          

[![Godocs](https://img.shields.io/badge/golang-documentation-blue.svg)](https://www.godoc.org/github.com/mayur-tolexo/j2s)
[![Go Report Card](https://goreportcard.com/badge/github.com/mayur-tolexo/j2s)](https://goreportcard.com/report/github.com/mayur-tolexo/j2s)
[![Open Source Helpers](https://www.codetriage.com/mayur-tolexo/sworker/badges/users.svg)](https://www.codetriage.com/mayur-tolexo/j2s)
[![Release](https://img.shields.io/github/release/mayur-tolexo/sworker.svg?style=flat-square)](https://github.com/mayur-tolexo/j2s/releases)

# jsonToStruct
Golang code generator for creating struct from json.

### INSTALLATION
go get github.com/mayur-tolexo/j2s

### Tags:
- -ip=input.json [Input File (default "input.json")]
- -op=bakery.go [Output File (default "output.go")]
- -name=Bakery [Structure Name (default "User")]
- -reuse=1 [if you want to reuse struct having same fields (default 0)]

#### Create Struct from console json.
| Command | Output |
| ------------- |:-------------:|
|![Screenshot 2019-11-16 at 12 31 41 AM](https://user-images.githubusercontent.com/20511920/68968935-bf928580-0809-11ea-8249-f3f91503ea4d.png)| ![Screenshot 2019-11-16 at 12 32 14 AM](https://user-images.githubusercontent.com/20511920/68968979-d9cc6380-0809-11ea-89ef-35942637395f.png) |

#### Create struct from json input file.
![Screenshot 2019-11-16 at 12 33 10 AM](https://user-images.githubusercontent.com/20511920/68968551-ddabb600-0808-11ea-84e7-2c54fbc5aef0.png)

| Input | Output |
| ------------- |:-------------:|
| ![Screenshot 2019-11-16 at 12 32 37 AM](https://user-images.githubusercontent.com/20511920/68968647-1ea3ca80-0809-11ea-961b-d3fc926d0252.png)| ![Screenshot 2019-11-16 at 12 33 24 AM](https://user-images.githubusercontent.com/20511920/68968696-3da25c80-0809-11ea-9c9d-0a0191244f55.png) |