python version of json-to-go.
How to Use
converter = json2go.JsonToGo()
print(converter.Convert(JsonString))
Results
type AutoGenerated []struct {
InputIndex int `json:"input_index"`
CandidateIndex int `json:"candidate_index"`
DeliveryLine_1 string `json:"delivery_line_1"`
LastLine string `json:"last_line"`
DeliveryPointBarcode string `json:"delivery_point_barcode"`
Components struct {
PrimaryNumber string `json:"primary_number"`
StreetPredirection string `json:"street_predirection"`
StreetName string `json:"street_name"`
StreetSuffix string `json:"street_suffix"`
CityName string `json:"city_name"`
StateAbbreviation string `json:"state_abbreviation"`
Zipcode string `json:"zipcode"`
Plus4Code string `json:"plus4_code"`
DeliveryPoint string `json:"delivery_point"`
DeliveryPointCheckDigit string `json:"delivery_point_check_digit"`
} `json:"components"`
Metadata struct {
RecordType string `json:"record_type"`
ZipType string `json:"zip_type"`
CountyFips string `json:"county_fips"`
CountyName string `json:"county_name"`
CarrierRoute string `json:"carrier_route"`
CongressionalDistrict string `json:"congressional_district"`
Rdi string `json:"rdi"`
ElotSequence string `json:"elot_sequence"`
ElotSort string `json:"elot_sort"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Precision string `json:"precision"`
TimeZone string `json:"time_zone"`
UtcOffset int `json:"utc_offset"`
Dst bool `json:"dst"`
} `json:"metadata"`
Analysis struct {
DpvMatchCode string `json:"dpv_match_code"`
DpvFootnotes string `json:"dpv_footnotes"`
DpvCmra string `json:"dpv_cmra"`
DpvVacant string `json:"dpv_vacant"`
Active string `json:"active"`
} `json:"analysis"`
}
With Go Generate
...
//go:generate python ./script/model_generator.py --input ./json/ --output ./models/ --package models --caution
...
Result
// Code generated by go generate; DO NOT EDIT
package models
type GetProfile struct {
Activities []struct {
CommentCount int `json:"comment_count"`
Downloadable bool `json:"downloadable"`
...