TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Qq: like jq, but can transcode between many formats

115 pointsby arandomhuman11 months ago
qq is jq inspired interoperable config format transcoder with interactive querying. It features an optional interactive editor with autocomplete for structured data. And supports inputs and outputs for json, xml, ini, toml, yaml, hcl, tf, and csv to varying degrees of capability.

7 comments

krick11 months ago
I think there may already exist a jq alternative for every letter of English alphabet. Why not just make a tool that <i>specializes</i> at transcoding csv&#x2F;json&#x2F;xml&#x2F;protobuf&#x2F;etc, and leave querying to any of dozens of these utils, that already exist? So that I can write qq input.xml -o json | jq &#x27;.&#x27; | qq -f json -o hcl? It&#x27;s not like the intention is to bring something new with regards to querying lanuage, the &quot;real stuff&quot; is just an heuristic transcoder of popular data serialization formats.
评论 #40794082 未加载
akhenakh11 months ago
Readers may be interested to Dasel as well <a href="https:&#x2F;&#x2F;daseldocs.tomwright.me&#x2F;supported-file-formats" rel="nofollow">https:&#x2F;&#x2F;daseldocs.tomwright.me&#x2F;supported-file-formats</a>
w10-111 months ago
This is so promising!<p>I presume like pandoc, the goal is to use an internal model to reduce the M*N complexity of format transcoding to M+N.<p>But when I look at the tests for this (and Dasel and rq also mentioned here), I see very little. jq seems to have much more. Perhaps I&#x27;m missing them.<p>Which leads to some side&#x2F;related comments...<p>A great project would be to build a transcoded test suite that all these tools could run against. It wouldn&#x27;t be hard to generate.<p>Also, while go is a great language, I think pandoc gets a lot of benefit from implementing the internal model in haskell. Pandoc has a much harder problem because there&#x27;s a lot more variability and less structure in the formats, so it should be doable for formats.
评论 #40792861 未加载
mutant11 months ago
Honest question, yq pretty much does this, are you solving for something yq doesn&#x27;t?
评论 #40785151 未加载
ec10968511 months ago
As an aside, chatgpt is very good at generating jq queries from an example input and text version of the query.
评论 #40792203 未加载
arandomhuman11 months ago
This is still under a lot of change, expect more formats to be supported along with some general improvements to interactive mode and autocomplete.
评论 #40787269 未加载
charlesdaniels11 months ago
I have been working on a project in a similar vein: rq[0]. Mine started out as an attempt to make a jq-like frontend for the Rego[1] language. However, I do find myself using it to simply convert from one format to another, and for pretty printing, quite often.<p>The interactive mode that qq has is really slick. I didn&#x27;t torture test it, but it worked pretty smoothly with a quick test.<p>I see that the XML support is implemented using the same library as rq. This definitely has some problems, because the data model of XML does not map very cleanly onto JSON. In particular, I recall that I had problems using mxj to marshal arrays, and had to use this[2] ugly hack instead. qq seems to have done this a little more cleanly[3]. I may just have to lift this particular trick.<p>I definitely found CSV output to be challenging. Converting arbitrary JSON style data into something table shaped is pretty tricky. This[4] is my attempt. I have found it works well enough, though it isn&#x27;t perfect.<p>I can also see that qq hasn&#x27;t yet run into the byte order marker problem with CSV inputs yet. Might want to check out spkg&#x2F;bom[5].<p>One final breadcrumb I&#x27;ll drop - I drew a lot of inspiration for rq&#x27;s input parsers from conftest[6]. That may be a good resource to find more formats and see specific usage examples of them.<p>Thanks for sharing! It&#x27;s really interesting to see some of the convergent evolution between rq and qq.<p>0 - <a href="https:&#x2F;&#x2F;git.sr.ht&#x2F;~charles&#x2F;rq" rel="nofollow">https:&#x2F;&#x2F;git.sr.ht&#x2F;~charles&#x2F;rq</a><p>1 - <a href="https:&#x2F;&#x2F;www.openpolicyagent.org&#x2F;docs&#x2F;latest&#x2F;policy-language&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.openpolicyagent.org&#x2F;docs&#x2F;latest&#x2F;policy-language&#x2F;</a><p>2 - <a href="https:&#x2F;&#x2F;git.sr.ht&#x2F;~charles&#x2F;rq&#x2F;tree&#x2F;c67df633c0438763956ff8646add75525dfb5b24&#x2F;item&#x2F;io&#x2F;output_xml.go#L72" rel="nofollow">https:&#x2F;&#x2F;git.sr.ht&#x2F;~charles&#x2F;rq&#x2F;tree&#x2F;c67df633c0438763956ff8646...</a><p>3 - <a href="https:&#x2F;&#x2F;github.com&#x2F;JFryy&#x2F;qq&#x2F;blob&#x2F;2f750f04def47bec9be100b7c89b6a2fde1fdbf7&#x2F;codec&#x2F;xml_codec.go#L14">https:&#x2F;&#x2F;github.com&#x2F;JFryy&#x2F;qq&#x2F;blob&#x2F;2f750f04def47bec9be100b7c89...</a><p>4 - <a href="https:&#x2F;&#x2F;git.sr.ht&#x2F;~charles&#x2F;rq&#x2F;tree&#x2F;c67df633c0438763956ff8646add75525dfb5b24&#x2F;item&#x2F;util&#x2F;util.go#L536" rel="nofollow">https:&#x2F;&#x2F;git.sr.ht&#x2F;~charles&#x2F;rq&#x2F;tree&#x2F;c67df633c0438763956ff8646...</a><p>5 - github.com&#x2F;spkg&#x2F;bom<p>6 - <a href="https:&#x2F;&#x2F;github.com&#x2F;open-policy-agent&#x2F;conftest">https:&#x2F;&#x2F;github.com&#x2F;open-policy-agent&#x2F;conftest</a>
评论 #40792347 未加载
评论 #40792018 未加载