Code Explainers

Code explainers tagged #json-decoding

go
package api
 
import (
	"encoding/json"

Safely decoding JSON in a Go HTTP handler

http json-decoding input-validation
Intermediate 8 steps
go
type SensorReading struct {
	DeviceID    string    `json:"device_id" binding:"required"`
	Temperature float64   `json:"temperature"`
	RecordedAt  time.Time `json:"recorded_at" binding:"required"`

Streaming NDJSON ingestion in Gin

streaming batching json-decoding
Advanced 10 steps
go
package payments
 
import (
	"context"

Fetching a charge over HTTP in Go

context-timeout http-client json-decoding
Intermediate 6 steps