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!

This entry was posted in Client Technologies and tagged . Bookmark the permalink.

10 Responses to List of US States in JavaScript object notation

  1. donavon says:

    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. Jon says:

    Shouldnt the keys be in quotes to be valid json?

  3. Adam Kinney says:

    Yep, that’s true. I should have mentioned I am just using this as a static array in my project, I’m not passing it through a service.

  4. The all-caps names are making my eyes bleed! :)

    FWIW, a quick google search turns up this (not-all-caps) version :) It seems to be redundant with name and label, though (at least spot-checking a few)

    http://bugs.dojotoolkit.org/attachment/ticket/7273/states.json

  5. Adam Kinney says:

    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.

  6. 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

  7. Adam Kinney says:

    Oh nice, thanks for sharing Michael!

  8. Felix Guerrero says:

    Thank you, I’m using it on my mobile app.

  9. T-Smooth says:

    Thanks for sharing!!!!

  10. Josh says:

    For those looking to work with State JSON data, I creating something similar, but with images of each state. https://github.com/tannerjt/state_images.json

Leave a Reply