Structs can be marshalled (encoded) into [[json]] easily using json.MarshalIndent
from the encoding/json
package. To create a desired JSON format without changing the underlying struct, field tags can be used.
To use JSON field tags:
type weatherData struct { LocationName string `json:"location"` Weather string `json:"weather"` }