Turn output of command into valid json? : <p>How can I use bash commands to convert the output of 'kubectl cluster-info dump' into valid json?</p>

<p>As is, right now, it comes out like this (extremely abbreviated):</p>

<pre><code>{
    "selfLink": "/api/v1/nodes",
    "resourceVersion": "24393",
    "Items": [tons of json]
}
{
    "selfLink": "/api/v1/namespaces/default/events",
    "resourceVersion": "24393",
    "Items": [tons of json]
}
...
{
    "selfLink": "/api/v1/namespaces/default/pods",
    "resourceVersion": "24393",
    "Items": [tons of json]
}
</code></pre>

<p>I would like to pipe the output of this command through sed or awk to translate this output into valid json, something like:</p>

<pre><code>[{"k","v","k2","v2"},
 {"k","v","k2","v2"},
 ...
 {"k","v","k2","v2"}]
</code></pre>

<p>which I can then easily parse with json parsers like jq</p>
