mirror of
https://github.com/xperimental/nextcloud-exporter
synced 2025-06-04 03:05:51 +02:00
18 lines
344 B
Go
18 lines
344 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 := struct {
|
|
ServerInfo ServerInfo `json:"ocs"`
|
|
}{}
|
|
if err := json.NewDecoder(r).Decode(&result); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &result.ServerInfo, nil
|
|
}
|