Skip to content

Instantly share code, notes, and snippets.

@hugozhu
Created March 17, 2013 03:46
Show Gist options
  • Save hugozhu/5179474 to your computer and use it in GitHub Desktop.
Save hugozhu/5179474 to your computer and use it in GitHub Desktop.
curl -s "http://m.weather.com.cn/data/101210101.html" | go run src/main.go
package main
import (
"encoding/json"
"log"
"os"
)
type Result struct {
WeatherInfo *WeatherInfo
}
type WeatherInfo struct {
City string
City_en string
Date_y string
Date string
Week string
Fchh string
Cityid int
Temp1 string
Temp2 string
}
func main() {
var result *Result
decoder := json.NewDecoder(os.Stdin)
decoder.Decode(&result)
log.Println(result.WeatherInfo.City)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment