paolosimone / virtual-json-viewer

JSON browser extension with virtual DOM, search and JQ filtering
Other
58 stars 3 forks source link

Fall back to "raw" view when JQ output isn't parseable #51

Open nightpool opened 2 hours ago

nightpool commented 2 hours ago

Now that the extension has a "raw" view fallback, I think https://github.com/paolosimone/virtual-json-viewer/issues/22 and #38 can be revisited. It's probably the most common issue users run into with this extension—writing a JQ query they expect to work and then being stymied by the limitations of the viewer. I know it happened to me within 5 minutes of installing it.

Alternatively, at the very least, please add support for the "newline delimited JSON" formats which JQ outputs natively when you using the stream parsing helpers, like []. In this case if JSON parsing fails, you can fall back to parsing each line itself as individual JSON content.

nightpool commented 2 hours ago

In fact, since the current extension doesn't provide any way to pass flags like --raw or --csv, the "newline delimited JSON" format is the only possible output of JQ that should exist. So there's really no need to fall back to the raw format if you extend the virtual viewer to allow displaying multiple JSON objects sequentially