You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msg: fmt.Sprintf("invalid character '%c' looking for beginning of value", c),
Offset: cursor,
}
}
But actually... the error was because the field I was trying to serialize into was "an object" rather than "a string". Once I changed that (which I did because of a very random lightbulb-turns-on moment) the deserialization worked again exactly as I would have expected it to.
Finding this was ... well, let's just say my day is a little ruined. x)
Therefore I would love to propose adding more context into errors:
Segment that was attempted to be parsed (a range, perhaps)
What the value was ment to be serialized into (i.e. ...while unmarshaling %s into %T or something)
Probably a reminder for dumb people like me that unmarshaling is dictated by the target type (very optional though.... cough :) )
Having had a little more information on the error could've saved me a lot of troubble today - so, after my little realization, I thought I might as well put this out here as a feature request.
Thank you and kind regards!
The text was updated successfully, but these errors were encountered:
Hello!
So, I just spent a good four hours trying to figure out why I could no longer deserialize my data into a struct and I kept getting this error here:
go-json/internal/errors/error.go
Lines 159 to 164 in 9872089
But actually... the error was because the field I was trying to serialize into was "an object" rather than "a string". Once I changed that (which I did because of a very random lightbulb-turns-on moment) the deserialization worked again exactly as I would have expected it to.
Finding this was ... well, let's just say my day is a little ruined. x)
Therefore I would love to propose adding more context into errors:
...while unmarshaling %s into %T
or something)Having had a little more information on the error could've saved me a lot of troubble today - so, after my little realization, I thought I might as well put this out here as a feature request.
Thank you and kind regards!
The text was updated successfully, but these errors were encountered: