Debian Codegraph @

serverinfo/parse.go

raw symbols SCIP
1 package serverinfo
2
3 import (
4 "encoding/json"
5 "io"
6 )
7
8 // ParseJSON reads ServerInfo from a Reader in JSON format.
9 func ParseJSON(r io.Reader) (*ServerInfo, error) {
10 result := struct {
11 ServerInfo ServerInfo `json:"ocs"`
12 }{}
13 if err := json.NewDecoder(r).Decode(&result); err != nil {
14 return nil, err
15 }
16
17 return &result.ServerInfo, nil
18 }