List of US States in JavaScript object notation

For my future self and the rest of you who may need it at some point in your JavaScript developer life, here is a list of the US States and Territories in JavaScript object notation, sometimes lovingly referred to as JSON.

This is it.  An internet bookmark for JSON states. Really, I just don’t want to go through formatting this again.  I think this was my second time actually…

Enjoy!

14 thoughts on “List of US States in JavaScript object notation

  1. Depending on what you are looking for, you may want the object keyed off of abbreviation:

    var states = {};
    usStates.forEach(function(s){states[s.abbreviation]=s.name});

  2. Hmm, surprised I didn’t find that one. Guess my searching skills were sub par at the time.

    For comparison purposes I wanted either all lowercase or all uppercase, the USPS site had all caps so that’s what I ended up with.

    My main use case here was to be able to find the abbreviation based on the state name.

  3. Thanks for this! By the way, the name for Guam shows up as “GUAM GU”. I think it should just be “GUAM”.

    I created a Gist for two more forms of the states list
    – titlecase form (first letter of every word is uppercase, remaining letters lowercase)
    – dictionary form (using donovan’s suggestion)

    https://gist.github.com/2646763

  4. In Eclipse:

    CTRL+SHIFT+Y on a selection of text converts it to lowercase.
    CTRL+SHIFT+X does the opposite to a selection of text.

    [code]
    var states:
    [
    { name: ‘Alabama’, abbreviation: ‘AL’},
    { name: ‘Alaska’, abbreviation: ‘AK’},
    { name: ‘American Samoa’, abbreviation: ‘AS’},
    { name: ‘Arizona’, abbreviation: ‘AZ’},
    { name: ‘Arkansas’, abbreviation: ‘AR’},
    { name: ‘California’, abbreviation: ‘CA’},
    { name: ‘Colorado’, abbreviation: ‘CO’},
    { name: ‘Connecticut’, abbreviation: ‘CT’},
    { name: ‘Delaware’, abbreviation: ‘DE’},
    { name: ‘District of Columbia’, abbreviation: ‘DC’},
    { name: ‘Federated States of Micronesia’, abbreviation: ‘FM’},
    { name: ‘Florida’, abbreviation: ‘FL’},
    { name: ‘Georgia’, abbreviation: ‘GA’},
    { name: ‘Guam’, abbreviation: ‘GU’},
    { name: ‘Hawaii’, abbreviation: ‘HI’},
    { name: ‘Idaho’, abbreviation: ‘ID’},
    { name: ‘Illinois’, abbreviation: ‘IL’},
    { name: ‘Indiana’, abbreviation: ‘IN’},
    { name: ‘Iowa’, abbreviation: ‘IA’},
    { name: ‘Kansas’, abbreviation: ‘KS’},
    { name: ‘Kentucky’, abbreviation: ‘KY’},
    { name: ‘Louisiana’, abbreviation: ‘LA’},
    { name: ‘Maine’, abbreviation: ‘ME’},
    { name: ‘Marshall Islands’, abbreviation: ‘MH’},
    { name: ‘Maryland’, abbreviation: ‘MD’},
    { name: ‘Massachusetts’, abbreviation: ‘MA’},
    { name: ‘Michigan’, abbreviation: ‘MI’},
    { name: ‘Minnesota’, abbreviation: ‘MN’},
    { name: ‘Mississippi’, abbreviation: ‘MS’},
    { name: ‘Missouri’, abbreviation: ‘MO’},
    { name: ‘Montana’, abbreviation: ‘MT’},
    { name: ‘Nebraska’, abbreviation: ‘NE’},
    { name: ‘Nevada’, abbreviation: ‘NV’},
    { name: ‘New Hampshire’, abbreviation: ‘NH’},
    { name: ‘New Jersey’, abbreviation: ‘NJ’},
    { name: ‘New Mexico’, abbreviation: ‘NM’},
    { name: ‘New York’, abbreviation: ‘NY’},
    { name: ‘North Carolina’, abbreviation: ‘NC’},
    { name: ‘North Dakota’, abbreviation: ‘ND’},
    { name: ‘Northern Mariana Islands’, abbreviation: ‘MP’},
    { name: ‘Ohio’, abbreviation: ‘OH’},
    { name: ‘Oklahoma’, abbreviation: ‘OK’},
    { name: ‘Oregon’, abbreviation: ‘OR’},
    { name: ‘Palau’, abbreviation: ‘PW’},
    { name: ‘Pennsylvania’, abbreviation: ‘PA’},
    { name: ‘Puerto Rico’, abbreviation: ‘PR’},
    { name: ‘Rhode Island’, abbreviation: ‘RI’},
    { name: ‘South Carolina’, abbreviation: ‘SC’},
    { name: ‘South Dakota’, abbreviation: ‘SD’},
    { name: ‘Tennessee’, abbreviation: ‘TN’},
    { name: ‘Texas’, abbreviation: ‘TX’},
    { name: ‘Utah’, abbreviation: ‘UT’},
    { name: ‘Vermont’, abbreviation: ‘VT’},
    { name: ‘Virgin Islands’, abbreviation: ‘VI’},
    { name: ‘Virginia’, abbreviation: ‘VA’},
    { name: ‘Washington’, abbreviation: ‘WA’},
    { name: ‘West Virginia’, abbreviation: ‘WV’},
    { name: ‘Wisconsin’, abbreviation: ‘WI’},
    { name: ‘Wyoming’, abbreviation: ‘WY’ }
    ]

  5. Though, I should add that Federated States of Micronesia is now an independent nation, Marshall Islands are a part of Micronesia geographically – and its own island country no longer considered US Territory, and Palau is also geographically a part of Micronesia – and its own island country no longer considered US Territory.

  6. I used a regex to rewrite it as a structure, which is more useful for what I’m doing but since you shared, I thought I’d share.

    var usStates = {
    AL: “ALABAMA”,AK: “ALASKA”,AS: “AMERICAN SAMOA”,AZ: “ARIZONA”,AR: “ARKANSAS”,CA: “CALIFORNIA”,CO: “COLORADO”,CT: “CONNECTICUT”,DE: “DELAWARE”,DC: “DISTRICT OF COLUMBIA”,FM: “FEDERATED STATES OF MICRONESIA”,FL: “FLORIDA”,GA: “GEORGIA”,GU: “GUAM”,HI: “HAWAII”,ID: “IDAHO”,IL: “ILLINOIS”,IN: “INDIANA”,IA: “IOWA”,KS: “KANSAS”,KY: “KENTUCKY”,LA: “LOUISIANA”,ME: “MAINE”,MH: “MARSHALL ISLANDS”,MD: “MARYLAND”,MA: “MASSACHUSETTS”,MI: “MICHIGAN”,MN: “MINNESOTA”,MS: “MISSISSIPPI”,MO: “MISSOURI”,MT: “MONTANA”,NE: “NEBRASKA”,NV: “NEVADA”,NH: “NEW HAMPSHIRE”,NJ: “NEW JERSEY”,NM: “NEW MEXICO”,NY: “NEW YORK”,NC: “NORTH CAROLINA”,ND: “NORTH DAKOTA”,MP: “NORTHERN MARIANA ISLANDS”,OH: “OHIO”,OK: “OKLAHOMA”,OR: “OREGON”,PW: “PALAU”,PA: “PENNSYLVANIA”,PR: “PUERTO RICO”,RI: “RHODE ISLAND”,SC: “SOUTH CAROLINA”,SD: “SOUTH DAKOTA”,TN: “TENNESSEE”,TX: “TEXAS”,UT: “UTAH”,VT: “VERMONT”,VI: “VIRGIN ISLANDS”,VA: “VIRGINIA”,WA: “WASHINGTON”,WV: “WEST VIRGINIA”,WI: “WISCONSIN”,WY: “WYOMING”}

Leave a Reply