Skip to content

Demo: interactive jq / fx #10

@cben

Description

@cben

Everyone loves interactive jq playgrounds, like https://github.com/ynqa/jnv 💗.
In practice, much of the time an interactive json viewer like jless or fx is more productive than editing queries, but ideally one tool would cover both.

  • fx has CLI mode taking JS queries, and disjoint interactive mode without queries (recommends piping e.g. fx '.query' | fx).
  • Currently both jless and fx have shortcuts to "exit and print path" for later use in jq / JS.

Well I can't easily try out jq syntax in browser, but can compete with fx!
[JS has pretty good suffix .map(...), .filter(...) etc. and I could even monkey-patch Object — not robust but helps PoC in absence of pipe operator e.g. |> Object.entries etc.]

The goal is make a JSON renderer where parts are clickable, e.g. clicking "key": zooms into that value by appending .key to the program. Thus combining best of interactive/editable world, avoiding awkwardness of temporarily breaking the output while typing . -> .k -> .ke -> .key.

  • Can default to "treat similar paths similarly" e.g. clicking .foo[0].bar affects all .foo[].bar in jq syntax / .foo.map(x => x.bar) in JS.
  • How to model scrolling, and reversible collapse/expand on click, purely functionally? Can add metadata to objects keyed on JS symbols. Need something like "lens" to neatly express "apply to these path[s], leave rest untouched"...

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions