Module 06 Β· HTTP with net/http β Lesson 2 of 3 Β· ~11 min
JSON
Structs in, JSON out
The app didn't want the text Hello β it wanted data: a list of walkers with names and prices, as JSON. Go's encoding/json package converts between your Go structs and JSON, and it's built into the standard library like everything else.
The rule of thumb: your server holds data as structs (typed, checked by the compiler) and speaks JSON on the wire. encoding/json is the translator in the middle.