Created by: ewheeler
Update csvjson to output utf-8 correctly. Current code will output utf-8 like:
"short_name_en": "\u00c5LAND ISLANDS"
instead of:
"short_name_en": "ÅLAND ISLANDS"
Also add option to output json objects keyed by a column name instead of a list.
Currently, csvjson outputs a list of dict-like JSON objects:
csvjson -i 2 countries-of-earth.csv
outputs:
[
  {
    "FIFA": "ALD", 
    "Dial": "358", 
    "ITU": " ", 
    "MARC": " ", 
    "is_independent": "Part of FI", 
    "DS": "FIN", 
    "WMO": " ", 
    "GAUL": "1242", 
    "ISO3166-1-numeric": "248", 
    "FIPS": " ", 
    "short_name_fr": "ÅLAND, ÎLES", 
    "ISO3166-1-Alpha-3": "ALA", 
    "IOC": " ", 
    "ISO3166-1-Alpha-2": "AX", 
    "short_name_en": "ÅLAND ISLANDS"
  }, 
  ...
]
The proposed new option accepts a named key (column name) and outputs a single dict-like JSON object where item values are the same dict-like JSON row representations that are currently outputted -- but the item names are the object's values for the given key:
csvjson -i 2 -k ISO3166-1-Alpha-2 countries-of-earth.csv
outputs:
{
  "AX": {
    "FIFA": "ALD", 
    "Dial": "358", 
    "ITU": " ", 
    "MARC": " ", 
    "is_independent": "Part of FI", 
    "DS": "FIN", 
    "WMO": " ", 
    "GAUL": "1242", 
    "ISO3166-1-numeric": "248", 
    "FIPS": " ", 
    "short_name_fr": "ÅLAND, ÎLES", 
    "ISO3166-1-Alpha-3": "ALA", 
    "IOC": " ", 
    "ISO3166-1-Alpha-2": "AX", 
    "short_name_en": "ÅLAND ISLANDS"
  }, 
   ...
}