how to print json data
<p>I have following json file and python code and i need output example...</p>

<p><strong>json file</strong></p>

<pre><code>{"b": [{"1": "add"},{"2": "act"}],
"p": [{"add": "added"},{"act": "acted"}],
"pp": [{"add": "added"},{"act": "acted"}],
"s": [{"add": "adds"},{"act": "acts"}],
"ing": [{"add": "adding"},{"act": "acting"}]}
</code></pre>

<p><strong>python</strong></p>

<pre><code>import json
data = json.load(open('jsonfile.json'))
#print data
</code></pre>

<p><strong>out put example</strong></p>

<pre><code>&gt;&gt; b
&gt;&gt; p
&gt;&gt; pp
&gt;&gt; s
&gt;&gt; ing
</code></pre>

<p>any ideas how to do that?</p>

<p>Simply unpack the <code>keys</code> with <code>*</code> in a print call, this provides the keys as positional arguments to <code>print</code>; use <code>sep = '\n'</code> if you want each key on a different line:</p>

<pre><code>print(*data.keys(), sep= '\n')
</code></pre>

<p>This will print out:</p>

<pre><code>b
pp
p
ing
s
</code></pre>

<p>As noted by @WayneWerner <code>print(*data, sep='\n')</code> is in effect like calling <code>data.keys()</code> and achieves the same result.</p>

python json python-3.x