encoding/json: decoding error #43156
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
PropertiesStruct struct {
BasedOn string
Api float64
ApiId string
ClientId string
ClientSecret string
DefaultPage string
}
func (p PropertiesStruct) ...() {
...
gjson.FromFile(Core.Application.Directory+"/Properties", &p, &Standard)
...
}
func FromFile(filePath string, target interface{}, errorChannel *chan error) {
file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, 0777)
if err != nil {
*errorChannel <- err
}
data, err := ioutil.ReadAll(file)
if err != nil {
*errorChannel <- err
}
err = json.Unmarshal(data, target)
if err != nil {
*errorChannel <- err
}
file.Close()
}
What did you expect to see?
json decoded to caller (p)
What did you see instead?
When json.Unmarshal works it freezes but no crash.
I tried to set `json:"Smthng"` tags for struct members with same names as struct member names and it was as at start.
Then i changed json tag for apiid and clientid to `json:"ApiIP"` and `json:"ClientID"` and it decodes json and works "correctly".
The text was updated successfully, but these errors were encountered: