dex/vendor/github.com/mbanzon/simplehttp/parsing.go
2016-03-09 13:04:05 -08:00

16 lines
315 B
Go

package simplehttp
import (
"encoding/json"
"encoding/xml"
)
// Parses the HTTPResponse as JSON to the given interface.
func (r *HTTPResponse) ParseFromJSON(v interface{}) error {
return json.Unmarshal(r.Data, v)
}
func (r *HTTPResponse) ParseFromXML(v interface{}) error {
return xml.Unmarshal(r.Data, v)
}