friendica-exporter/serverinfo/parse.go
2024-10-27 19:51:26 +01:00

16 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
}