Trying to parse a json file that contains a byte order mark results in an error
[]byte{0xEF, 0xBB, 0xBF} (the first 3 bytes of the file)
// LocaleMessage represents a single translation for an entry in the localization map.
type LocaleMessage struct {
Message string json:"message"
Description string json:"description"
}
The error message returned while trying to unmarshal:
invalid character 'ï' looking for beginning of value
The json file in question is from a chrome extension that ships with ChromeOS (I seem not to be able to attach the json file -> unsupported file type).
When I trim the first 3 bytes, it parses just fine.
The text was updated successfully, but these errors were encountered:
Trying to parse a json file that contains a byte order mark results in an error
[]byte{0xEF, 0xBB, 0xBF} (the first 3 bytes of the file)
// LocaleMessage represents a single translation for an entry in the localization map.
type LocaleMessage struct {
Message string
json:"message"
Description string
json:"description"
}
lj := make(map[string]LocaleMessage)
if err := json.Unmarshal(data, &lj); err != nil {
return nil, err
}
The error message returned while trying to unmarshal:
invalid character 'ï' looking for beginning of value
The json file in question is from a chrome extension that ships with ChromeOS (I seem not to be able to attach the json file -> unsupported file type).
When I trim the first 3 bytes, it parses just fine.
The text was updated successfully, but these errors were encountered: