Last active
December 20, 2015 23:09
-
-
Save MattOates/6210682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import( | |
"fmt" | |
"net/http" | |
"net/url" | |
"io/ioutil" | |
"encoding/json" | |
//"strings" | |
) | |
func main() { | |
request, err := http.PostForm("http://d2p2.pro/api/seqid",url.Values{"seqids":{"[\"P04637\"]"}}) | |
if err != nil { | |
// handle error | |
} | |
defer request.Body.Close() | |
body, err := ioutil.ReadAll(request.Body) | |
var response map[string]json.RawMessage | |
json.Unmarshal(body, &response) | |
var response1 []json.RawMessage | |
json.Unmarshal(response["P04637"], &response1) | |
var response2 []json.RawMessage | |
json.Unmarshal(response1[0], &response2) | |
var response3 map[string]json.RawMessage | |
json.Unmarshal(response2[2], &response3) | |
var response4 map[string]json.RawMessage | |
json.Unmarshal(response3["disorder"], &response4) | |
var response5 [][]string | |
json.Unmarshal(response4["disranges"], &response5) | |
for _,record := range response5 { | |
for _,field := range record { | |
fmt.Printf("%s\t", field) | |
} | |
fmt.Printf("\n") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment