Skip to content
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: retrieving underlying reader offset in UnmarshalJSON()? #21589

Julio-Guerra opened this issue Aug 24, 2017 · 1 comment


Copy link

Julio-Guerra commented Aug 24, 2017

I am using big json configuration files and trying to produce useful user error messages, at least including the current line in the file.

So my question is: is there any way to retrieve the underlying reader's offset from UnmarshalJSON() to be able to return parsing or validation errors including it?

go version go1.8.3 linux/amd64

@Julio-Guerra Julio-Guerra changed the title encoding/json: retrieving current file offset in UnmarshalJSON()? encoding/json: retrieving underlying reader offset in UnmarshalJSON()? Aug 24, 2017
Copy link

We don't use the issue tracker to ask questions. Please see . Thanks.

You can check whether the returned error value is a json.UnmarshalTypeError, which has an Offset field. See .

Closing because there is no bug here.

@golang golang locked and limited conversation to collaborators Aug 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants