title: trying to move lines 1-10 of a csv to a JSON file. I seem to only be getting the 10th line
body: <p>I'm fairly new to python and attempting to add lines 1-10 of a csv into a JSON file, however, I only seem to be getting the 10th line of the CSV. I can't seem to figure out what is incorrect about my argument. Any help appcreated!</p>
  
  <pre><code>import csv, json, itertools
  
  csvFilePath = "example.csv"
  jsonFilePath = "example.json"
  
      # Read the CSV and add data to a dictionary
  data = {}
  with open(csvFilePath) as csvFile:
          csvReader = csv.DictReader(csvFile)
          for csvRow in itertools.islice(csv.DictReader(csvFile), 0,10):
              data = csvRow
  
  print(data)
  
  
      #Write the data to a JSON file
      with open(jsonFilePath, "w") as jsonFile:
      jsonFile.write(json.dumps(data, indent=4))
  </code></pre>