title: Create JSON from CSV by Node
body: <p>I have a CSV of all the states/counties in the US. I'd like to turn this into JSON in the following format: </p>
  
  <pre><code>Alabma: [
    {
      "county_name":"Alabama -- Statewide",
      "fips":1000,
      "fips2":"'01000'",
    },
  </code></pre>
  
  <p>But the python I'm writing for this produces the following</p>
  
  <pre><code> State: [{
      "county_name":"Baldwin County",
      "fips":1003,
      "fips2":"'01003'",
      "state_name":" Alabama"
    },
  </code></pre>
  
  <p>I think I need just a little direction and I can figure this out. Thanks for your help! Here's my python:</p>
  
  <pre><code>import csv
  import json
  output = { 'state':[] }
  with open('county_state.csv', 'rU') as csv_file:
      for state_name in csv.DictReader(csv_file):
          output['state'].append({
              'fips': state_name['fips2'],
              'county': state_name['county_name']
  
          })
  
  print json.dumps(output)
  </code></pre>
  
  <p>Some example rows from the CSV file:</p>
  
  <pre><code>county_name fips    fips2   state_name
  Autauga County  01001   '01001'  Alabama
  Baldwin County  01003   '01003'  Alabama
  Barbour County  01005   '01005'  Alabama
  Putnam County   12107   '12107'  Florida
  St. Johns County    12109   '12109'  Florida
  St. Lucie County    12111   '12111'  Florida
  Santa Rosa County   12113   '12113'  Florida
  Emmet County    19063   '19063'  Iowa
  Fayette County  19065   '19065'  Iowa
  Floyd County    19067   '19067'  Iowa
  Franklin County 19069   '19069'  Iowa
  Fremont County  19071   '19071'  Iowa
  Greene County   19073   '19073'  Iowa
  Grundy County   19075   '19075'  Iowa
  Guthrie County  19077   '19077'  Iowa
  Hamilton County 19079   '19079'  Iowa
  Hancock County  19081   '19081'  Iowa
  </code></pre>