Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.05 KB

README.md

File metadata and controls

57 lines (40 loc) · 1.05 KB

jsonToStruct

A simple application to convert JSON data to go struct.

Example:

A sample JSON input to the application

{
  "name": "Barksalot",
  "species": "Dog",
  "age": 5,
  "photo": "https://learnwebcode.github.io/json-example/images/dog-1.jpg"
}

gets converted to the following struct.

type auto struct { 
  Name          string	`json:"name"`
  Species       string	`json:"species"`
  Age           int	`json:"age"`
  Photo         string	`json:"photo"`
}

Application in action

json-to-struct

App in action #2

Usage

./jsonToStruct <file1.json> <file2.json> ..

Installation

cd jsonToStruct
make exe

Dependencies (using go modules)

prerequisites

  • Golang 1.11

Todos

  • Write Unit Tests
  • Add and test with more JSON examples