friendica-exporter/serverinfo/parse.go

17 lines
295 B
Go
Raw Normal View History

2024-10-24 20:26:41 +02:00
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
}