This is a creation in Article, where the information may have evolved or changed.
Guess you like it.
- The JSON management mode of the Go language
- Golang JSON string Remove field
- Notes Golang JSON
- Go:json Parsing Library Go-simplejson use
- Golang 1.6: Database null value encountered JSON and templates (template)
- Beego under IE tips download json
- JSON encoding and decoding in Golang
- Com.google.gson.JsonArray Convert to List
- JSON in Go
First, submit JSON
reference: http://stackoverflow.com/a/24455606
func main () {URL: =" http://restapi3.apiary.io/notes "FMT. Println ("url:>", URL) var jsonstr = []byte (' {' "title": "Buy cheese and Bread for breakfast."} ') req, err: = http. Newrequest ("POST", url, bytes. Newbuffer (JSONSTR)) req. Header.set ("X-custom-header", "MyValue") req. Header.set ("Content-type", "Application/json") Client: = &http. client{} resp, err: = client. Do (req) if err! = Nil {panic (err)} Defer resp. Body.close () fmt. PRINTLN ("Response Status:", resp. Status) fmt. PRINTLN ("Response Headers:", resp. Header) Body, _: = Ioutil. ReadAll (resp. Body) fmt. PRINTLN ("Response Body:", String (Body))}
Second, get and parse JSON
Cond