@@ -0,0 +1,1029 @@
+#!/usr/bin/env python%0Aimport sys%0Aimport csv%0Aimport json%0Aimport re%0A%0Aif len(sys.argv) != 3:%0A  print 'Incorrect number of arguments.'%0A  print 'Usage: csv_to_json.py path_to_csv path_to_json'%0A  exit()%0A%0Aprint 'Argument List:', str(sys.argv)%0AcsvFileName = sys.argv%5B1%5D%0AjsonFileName = sys.argv%5B2%5D%0A%0AcsvFile = open (csvFileName, 'rU')%0AmyReader = csv.reader(csvFile)%0Aheader = myReader.next()%0Aprint %22Header fields:%22, header%0A%0AmyReader = csv.DictReader( csvFile, fieldnames = header) %0A%0AjsonFile = open( jsonFileName, 'w')  %0A%0A# far too fancy regex for my tastes.%0A# grabs words, makes the tag the last word prior to %22.csv%22%0AfileTag = re.findall(r%22%5B%5Cw'%5D+%22, csvFileName)%5B-2:-1%5D%5B0%5D%0A%0Adef writeNRecords(n):%0A  count = 0%0A  jsonFile.write(%22%5B%22)%0A  for row in myReader:%0A    row%5B'tag'%5D = fileTag%0A    parsedJson = json.dumps( row )%0A    jsonFile.write(parsedJson)%0A    count += 1%0A    if 0 == (count %25 n):%0A      break%0A    else:%0A      jsonFile.write(%22, %22)%0A  jsonFile.write(%22%5D%22)%0A%0AwriteNRecords(10000)%0A%0Aprint %22up to 10,000 JSON records saved to: %22, jsonFileName  %0A%0A

add preliminary file tagged json parser. outputs up to 10,000 lines