TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Flatito, grep for YAML and JSON files

65 点作者 ceritium大约 1 年前
It is a kind of grep for YAML and JSON files. It allows you to search for a key and get the value and the line number where it is located.<p>I created this tool because I sometimes struggle to find specific keys in typical i18n rails yamls. In the views, you don&#x27;t always have the whole key, but it is extrapolated from the context. I am sure there are other use cases; I hope you find it useful.<p>Cheers!

8 条评论

ratrocket大约 1 年前
This looks cool!<p>It doesn&#x27;t do quite the same thing, but a tool I&#x27;ve had good luck with for quick-n-dirty grepping of JSON is gron:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron">https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron</a><p>(which I&#x27;m sure I learned about from a thread like this on HN...)<p>It sort of &quot;flattens out&quot; your JSON to allow you to do whatever you want to it (grepping, for one thing!). Then you can even turn gron&#x27;s output back into JSON with `ungron`.<p>Maybe someone will find it a useful toolbox addition, much like the Flatito looks to be!
dimatura大约 1 年前
So I see that the name is derived from an esperanto word (apparently meaning &quot;flatter&quot;) but in spanish it would also mean a small burp (&quot;flato&quot; being an informal term for burp). Which I still like as a name ;)
评论 #39818322 未加载
评论 #39818004 未加载
评论 #39818433 未加载
评论 #39819247 未加载
al_borland大约 1 年前
I usually have to use JMESPath queries semi-regularly. Every time I do it feels like I&#x27;m starting over for the first time. I&#x27;d love something that made more sense to me, but in most cases I&#x27;m stuck with what I have due to restrictions on what I can use at work.
mutant大约 1 年前
This till doesn&#x27;t give any context about the keys context, what&#x27;s the full path of the key? That&#x27;s critically important.
gxonatano大约 1 年前
This is the kind of thing Nushell is already really good at.
account-5大约 1 年前
Is this different from yq?
评论 #39820910 未加载
Yasuraka大约 1 年前
What I often use to just get the full key paths is yq (<a href="https:&#x2F;&#x2F;github.com&#x2F;mikefarah&#x2F;yq">https:&#x2F;&#x2F;github.com&#x2F;mikefarah&#x2F;yq</a>), piping into grep when necessary<p><pre><code> yq -o=props &lt;file&gt; </code></pre> e.g.<p><pre><code> kind = Ingress metadata.name = hello spec.rules.0.host = localhost spec.rules.0.http.paths.0.pathType = ImplementationSpecific spec.rules.0.http.paths.0.backend.service.name = hello spec.rules.0.http.paths.0.backend.service.port.number = 80 </code></pre> The one drawback I&#x27;ve encountered so far are multi-doc files - yq can certainly handle those, but you have to script the loop yourself.
评论 #39822257 未加载
评论 #39819154 未加载
llimllib大约 1 年前
related project, gron: <a href="https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron">https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron</a><p><pre><code> ▶ gron &quot;https:&#x2F;&#x2F;api.github.com&#x2F;repos&#x2F;tomnomnom&#x2F;gron&#x2F;commits?per_page=1&quot; | fgrep &quot;commit.author&quot; json[0].commit.author = {}; json[0].commit.author.date = &quot;2016-07-02T10:51:21Z&quot;; json[0].commit.author.email = &quot;mail@tomnomnom.com&quot;; json[0].commit.author.name = &quot;Tom Hudson&quot;;</code></pre>
评论 #39820379 未加载
评论 #39819149 未加载