17 lines
295 B
Go
17 lines
295 B
Go
package serverinfo
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
)
|
|
|
|
// ParseJSON reads ServerInfo from a Reader in JSON format.
|
|
func ParseJSON(r io.Reader) (*ServerInfo, error) {
|
|
result := ServerInfo{}
|
|
if err := json.NewDecoder(r).Decode(&result); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &result, nil
|
|
}
|