-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/json: add offset to the reported errors #9693
Labels
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Sometimes JSON data can be inconsistent (Ex: bad APIs). One field can be string in one row, in another float64. It would help to figure out what field is responsible if there was at least the
offset
from the JSON file associated with the reported error.Example:
Suppose there is a data.json file that contains 10k rows and row 1230 has field HSigma a float64 instead of string. The error reported when unmarshalling would be:
json: cannot unmarshal string into Go value of type float64
Which is not very useful since we have a few string fields and we don't know the row. Instead something like this would tell me where I should look in my json file:
json: cannot unmarshal 'string' into Go value of type 'float64' offset 7427
The text was updated successfully, but these errors were encountered: