mirror of
https://github.com/astaxie/beego.git
synced 2025-07-06 01:30:20 +00:00
config: fix error when json config starts with an array
This commit is contained in:
@ -35,7 +35,12 @@ func (js *JsonConfig) Parse(filename string) (ConfigContainer, error) {
|
||||
}
|
||||
err = json.Unmarshal(content, &x.data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var wrappingArray []interface{}
|
||||
err2 := json.Unmarshal(content, &wrappingArray)
|
||||
if err2 != nil {
|
||||
return nil, err
|
||||
}
|
||||
x.data["rootArray"] = wrappingArray
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user