JSON to Go struct
Paste a JSON payload (an object or an array of objects) and get a Go struct with json tags. Types are inferred from the real values: fields that are missing or null in some records become pointers with ,omitempty, ISO timestamps become time.Time, and mixed types are flagged instead of guessed.
Inferred from the payload you paste, on the server, discarded after the response.
Example
[
{"id": 1, "sku": "A-100", "name": "Widget", "price": 9.99, "in_stock": true, "created_at": "2024-01-15T10:30:00Z"},
{"id": 2, "sku": "B-220", "name": "Gadget", "price": 19.5, "in_stock": false, "created_at": "2024-02-01T08:00:00Z"}
]
package models
import (
"time"
)
type Payload struct {
Id int64 `json:"id"`
Sku string `json:"sku"`
Name string `json:"name"`
Price float64 `json:"price"`
InStock bool `json:"in_stock"`
CreatedAt time.Time `json:"created_at"`
}