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
I like the idea, but I'm not entirely sure how easy it would be to implement. As far as I know, Go's JSON package doesn't deal with 'lines' when decoding JSON - even internally; it only maintains a byte offset as new-line characters don't have any meaning in JSON.
Short of writing my own JSON parser (or copying the parser form the standard library) and tracking the number of new-line characters seen I can't think of a way to do this. Even the byte-offset is only exposed when a parse error is encountered (e.g. when a json.UnmarshalTypeError type is returned).
I'm open to suggestions for good ways to do this if you or anyone else has any!
I'd like to be able to output the line numbers of the location of objects in the actual JSON. This would be helpful in utilizing
gron
to make JSON files searchable via reference in command line text editors like VIM (see https://vi.stackexchange.com/questions/15682/is-there-a-vim-plugin-available-to-add-jsonpath-jq-jmespath-path-searching ).I imagine it could output the line numbers inside a javascript comment so as to ensure that the output remains javascript compatible.
The text was updated successfully, but these errors were encountered: