How to convert a large Json file into a csv using python
<p>(Python 3.5)
I am trying to parse a large user review.json file (1.3gb) into python and convert to a .csv file. I have tried looking for a simple converter tool online, most of which accept a file size maximum of 1Mb or are super expensive.
 as i am fairly new to python i guess i ask 2 questions.</p>

<ol>
<li><p>is it even possible/ efficient to do so or should i be looking for another method?</p></li>
<li><p>I tried the following code, it only is reading the and writing the top 342 lines in my .json doc then returning an error.</p></li>
</ol>

<blockquote>
  <p>Blockquote 
    File "C:\Anaconda3\lib\json__init__.py", line 319, in loads
      return _default_decoder.decode(s)</p>
</blockquote>

<p>File "C:\Anaconda3\lib\json\decoder.py", line 342, in decode
    raise JSONDecodeError("Extra data", s, end) 
JSONDecodeError: Extra data</p>

<p><strong>This is the code im using</strong></p>

<pre><code>import csv
import json

infile = open("myfile.json","r")
outfile = open ("myfile.csv","w")

writer = csv.writer(outfile)

for row in json.loads(infile.read()):
  writer.writerow(row)
</code></pre>

<p><strong>my .json example:</strong></p>

<p>Link To small part of <a href="http://pastebin.com/mfHr703f" rel="nofollow">Json</a></p>

<p>My thoughts is its some type of error related to my for loop, with json.loads... but i do not know enough about it. Is it possible to create a dictionary{} and take convert just the values "user_id", "stars", "text"? or am i dreaming.</p>

<p>Any suggestions or criticism are appreciated.</p>

<p>This is not a JSON file; this is a file containing individual lines of JSON. You should parse each line individually.</p>

<pre><code>for row in infile:
  data = json.loads(row)
  writer.writerow(data)
</code></pre>

python json csv dictionary