Skip to content

Commit

Permalink
docs: add string to json array (#114) 3263edc
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 17, 2022
1 parent 13d3bf8 commit 8f4d612
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data.json

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion docs/jq.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<p>这个快速参考备忘单提供了使用 <a href="https://stedolan.github.io/jq/">jq</a> 命令的各种方法。</p>
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#介绍">介绍</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#选项">选项</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#学习示例">学习示例</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#获取一个键的值">获取一个键的值</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#数组运算">数组运算</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#构造一个数组对象">构造一个数组/对象</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#计算一个值的长度">计算一个值的长度</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#取出数组中的键">取出数组中的键</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#使用多个过滤器">使用多个过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#管道传递给下一个过滤器">管道传递给下一个过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#条件语句判断">条件语句判断</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#每个输入调用过滤器">每个输入调用过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#条件判断">条件判断</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#字符串插入值并进行运算">字符串插入值并进行运算</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#介绍">介绍</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#选项">选项</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#学习示例">学习示例</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#获取一个键的值">获取一个键的值</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#数组运算">数组运算</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#构造一个数组对象">构造一个数组/对象</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#计算一个值的长度">计算一个值的长度</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#取出数组中的键">取出数组中的键</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#使用多个过滤器">使用多个过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#管道传递给下一个过滤器">管道传递给下一个过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#条件语句判断">条件语句判断</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#每个输入调用过滤器">每个输入调用过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#条件判断">条件判断</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#字符串插入值并进行运算">字符串插入值并进行运算</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#字符串转-json-数组">字符串转 JSON 数组</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="介绍"><a aria-hidden="true" tabindex="-1" href="#介绍"><span class="icon icon-link"></span></a>介绍</h3><div class="wrap-body">
<p>jq 就像用于 JSON 数据的 <a href="./sed.html">sed</a> - 您可以使用它来切片、过滤、映射和转换结构化数据</p>
<ul>
Expand Down Expand Up @@ -247,6 +247,19 @@
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line"><span class="token string">"The input was 42, which is one less than 43"</span>
</span></code></pre>
<!--rehype:className=wrap-text -->
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="字符串转-json-数组"><a aria-hidden="true" tabindex="-1" href="#字符串转-json-数组"><span class="icon icon-link"></span></a>字符串转 JSON 数组</h3><div class="wrap-body">
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ <span class="token builtin class-name">echo</span> <span class="token string">'a b c d'</span> <span class="token operator">|</span> jq <span class="token parameter variable">-R</span> <span class="token string">'split(" ")'</span>
</span></code></pre>
<!--rehype:className=wrap-text -->
<p>输出结果</p>
<pre class="wrap-text "><code class="language-json code-highlight"><span class="code-line"><span class="token punctuation">[</span>
</span><span class="code-line"> <span class="token string">"a"</span><span class="token punctuation">,</span>
</span><span class="code-line"> <span class="token string">"b"</span><span class="token punctuation">,</span>
</span><span class="code-line"> <span class="token string">"c"</span><span class="token punctuation">,</span>
</span><span class="code-line"> <span class="token string">"d"</span>
</span><span class="code-line"><span class="token punctuation">]</span>
</span></code></pre>
<!--rehype:className=wrap-text -->
</div></div></div></div></div><div class="wrap h2body-not-exist"><div class="wrap-header h2wrap"><h2 id="另见"><a aria-hidden="true" tabindex="-1" href="#另见"><span class="icon icon-link"></span></a>另见</h2><div class="wrap-body">
<ul>
<li><a href="https://stedolan.github.io/jq/">jq 官网</a> <em>(stedolan.github.io)</em></li>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@
<!--rehype:class=home-card&style=margin:1.2rem 0;display: flex;justify-content: center;-->
<p>如果你有资源,可以很方便部署 web 版,这非常简单,只需要克隆 gh-pages 分支代码到你的静态服务就可以了,还可以使用 <a href="https://hub.docker.com/r/wcjiang/reference">docker</a> 快捷部署 web 版。</p>

</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang. Updated on 2022/11/17 08:02:06</footer></footer><script>
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang. Updated on 2022/11/17 08:23:14</footer></footer><script>
if(('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {
window.onhashchange = function () {
anchorPoint()
Expand Down

0 comments on commit 8f4d612

Please sign in to comment.