<p>Is there any easy command line option to export my entire ETCD database to json file but also  decode the keys and values automatically from base64?</p>
<p>What I succeeded to the moment is this(example show 1x key/value):</p>
<pre><code>   ./etcdctl get &quot;&quot; --prefix -w json | jq -r &quot;.[] | .[]  &quot;
 {
 &quot;key&quot;: &quot;YnktZGV2L21ldGEvc25hcHNob3RzL3Jvb3QtY29vcmQvcGFydGl0aW9ucy80NDAwNDc0MjQ2MTgzNjUxNzAvNDQwMDQ3NDI0NjE4MzY1MTcxX3RzNDQwMDQ5NDg5ODkxODE5NTI0&quot;,
&quot;create_revision&quot;: 44536,
&quot;mod_revision&quot;: 44536,
&quot;version&quot;: 1,
&quot;value&quot;: &quot;CPOB0OXRmdeNBhIIX2RlZmF1bHQYhIDgxN/V140GIPKB0OXRmdeNBg==&quot;
}
</code></pre>
<p>But I need to decode the entire database keys and values to human readable format?</p>
<p>Thanks</p>
<p>P.S.
Final solution after @Jeff Mercado help:</p>
<pre><code>1. /etcdctl get &quot;&quot; --prefix -w json | jq '.[]' &gt; etcd_filter.txt
2. Clear output to form array of objects [{},{} ...{}]
3. cat etcd_filter.txt | jq '.[] | (.key, .value) |= @base64d'
</code></pre>
<p><a href="https://jqplay.org/s/rglpDglWHNB" rel="nofollow noreferrer">jq playground</a></p>

<p>If the encoded data is a string and not binary data, you can decode it to a UTF-8 string using the <code>@base64d</code> filter. This should be available in jq 1.6.</p>
<pre><code>$ ./etcdctl ... | jq '.[][] | (.key, .value) |= @base64d'
{
  &quot;key&quot;: &quot;by-dev/meta/snapshots/root-coord/partitions/440047424618365170/440047424618365171_ts440049489891819524&quot;,
  &quot;create_revision&quot;: 44536,
  &quot;mod_revision&quot;: 44536,
  &quot;version&quot;: 1,
  &quot;value&quot;: &quot;\b���љ׍\u0006\u0012\b_default\u0018������׍\u0006 ���љ׍\u0006&quot;
}
</code></pre>
<p>It appears the value is not a UTF-8 string in your example so beware. Unfortunately, it doesn't return a byte array so it may not be very useful for these cases.</p>
<p><a href="https://jqplay.org/s/HV4PtqYSnPi" rel="nofollow noreferrer">jqplay</a></p>
