Skip to content

Instantly share code, notes, and snippets.

@rudenoise
Created October 24, 2012 15:48
Show Gist options
  • Save rudenoise/3946871 to your computer and use it in GitHub Desktop.
Save rudenoise/3946871 to your computer and use it in GitHub Desktop.
package main
import(
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
//"os"
)
var url = flag.String("url", "http://api.ent.nokia.com/1.x/gb/views/music/web/product?token=03574704-e3d1-4466-9691-e0b34c7abfff&id=36518123", "regexp pattern to exclude in file path")
func main() {
flag.Parse()
resp, err := http.Get(*url)
if err != nil { panic(err) }
defer resp.Body.Close()
s, err := ioutil.ReadAll(resp.Body)
if err != nil { panic(err) }
var f interface{}
json.Unmarshal(s, &f)
o, err := json.MarshalIndent(f, "\n", " ")
if err != nil { panic(err) }
fmt.Printf("\n%s\n\n", o)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment