Skip to content

Instantly share code, notes, and snippets.

@veganben
Last active August 15, 2019 18:37
Show Gist options
  • Save veganben/8348375 to your computer and use it in GitHub Desktop.
Save veganben/8348375 to your computer and use it in GitHub Desktop.
I couldn't find a periodic table of the elements in JSON format, so I made one. For unknown atomic weights, a value of NaN has been assigned.
elements = {
HYDROGEN: {
atomic_number: 1,
abbreviation: "H",
atomic_weight: 1.008
},
HELIUM: {
atomic_number: 2,
abbreviation: "He",
atomic_weight: 4.003
},
LITHIUM: {
atomic_number: 3,
abbreviation: "Li",
atomic_weight: 6.939
},
BERYLLIUM: {
atomic_number: 4,
abbreviation: "Be",
atomic_weight: 9.012
},
BORON: {
atomic_number: 5,
abbreviation: "B",
atomic_weight: 10.811
},
CARBON: {
atomic_number: 6,
abbreviation: "C",
atomic_weight: 12.011
},
NITROGEN: {
atomic_number: 7,
abbreviation: "N",
atomic_weight: 14.007
},
OXYGEN: {
atomic_number: 8,
abbreviation: "O",
atomic_weight: 15.999
},
FLUORINE: {
atomic_number: 9,
abbreviation: "F",
atomic_weight: 18.998
},
NEON: {
atomic_number: 10,
abbreviation: "Ne",
atomic_weight: 20.183
},
SODIUM: {
atomic_number: 11,
abbreviation: "Na",
atomic_weight: 22.990
},
MAGNESIUM: {
atomic_number: 12,
abbreviation: "Mg",
atomic_weight: 24.312
},
ALUMINIUM: {
atomic_number: 13,
abbreviation: "Al",
atomic_weight: 26.982
},
SILICON: {
atomic_number: 14,
abbreviation: "Si",
atomic_weight: 28.086
},
PHOSPHORUS: {
atomic_number: 15,
abbreviation: "P",
atomic_weight: 30.974
},
SULPHUR: {
atomic_number: 16,
abbreviation: "S",
atomic_weight: 32.064
},
CHLORINE: {
atomic_number: 17,
abbreviation: "Cl",
atomic_weight: 35.453
},
ARGON: {
atomic_number: 18,
abbreviation: "Ar",
atomic_weight: 39.948
},
POTASSIUM: {
atomic_number: 19,
abbreviation: "K",
atomic_weight: 39.102
},
CALCIUM: {
atomic_number: 20,
abbreviation: "Ca",
atomic_weight: 40.08
},
SCANDIUM: {
atomic_number: 21,
abbreviation: "Sc",
atomic_weight: 44.956
},
TITANIUM: {
atomic_number: 22,
abbreviation: "Ti",
atomic_weight: 47.90
},
VANADIUM: {
atomic_number: 23,
abbreviation: "V",
atomic_weight: 50.94
},
CHROMIUM: {
atomic_number: 24,
abbreviation: "Cr",
atomic_weight: 52.00
},
MANGANESE: {
atomic_number: 25,
abbreviation: "Mn",
atomic_weight: 54.94
},
IRON: {
atomic_number: 26,
abbreviation: "Fe",
atomic_weight: 55.85
},
COBALT: {
atomic_number: 27,
abbreviation: "Co",
atomic_weight: 58.93
},
NICKEL: {
atomic_number: 28,
abbreviation: "Ni",
atomic_weight: 58.71
},
COPPER: {
atomic_number: 29,
abbreviation: "Cu",
atomic_weight: 63.54
},
ZINC: {
atomic_number: 30,
abbreviation: "Zn",
atomic_weight: 65.37
},
GALLIUM: {
atomic_number: 31,
abbreviation: "Ga",
atomic_weight: 69.72
},
GERMANIUM: {
atomic_number: 32,
abbreviation: "Ge",
atomic_weight: 72.59
},
ARSENIC: {
atomic_number: 33,
abbreviation: "As",
atomic_weight: 74.92
},
SELENIUM: {
atomic_number: 34,
abbreviation: "Se",
atomic_weight: 78.96
},
BROMINE: {
atomic_number: 35,
abbreviation: "Br",
atomic_weight: 79.909
},
KRYPTON: {
atomic_number: 36,
abbreviation: "Kr",
atomic_weight: 83.80
},
RUBIDIUM: {
atomic_number: 37,
abbreviation: "Rb",
atomic_weight: 85.47
},
STRONTIUM: {
atomic_number: 38,
abbreviation: "Sr",
atomic_weight: 87.62
},
YTTRIUM: {
atomic_number: 39,
abbreviation: "Y",
atomic_weight: 88.905
},
ZIRCONIUM: {
atomic_number: 40,
abbreviation: "Zr",
atomic_weight: 91.22
},
NIOBIUM: {
atomic_number: 41,
abbreviation: "Nb",
atomic_weight: 92.906
},
MOLYBDENUM: {
atomic_number: 42,
abbreviation: "Mo",
atomic_weight: 95.94
},
TECHNETIUM: {
atomic_number: 43,
abbreviation: "Tc",
atomic_weight: 99.00
},
RUTHENIUM: {
atomic_number: 44,
abbreviation: "Ru",
atomic_weight: 101.07
},
RHODIUM: {
atomic_number: 45,
abbreviation: "Rh",
atomic_weight: 102.92
},
PALLADIUM: {
atomic_number: 46,
abbreviation: "Pd",
atomic_weight: 106.4
},
SILVER: {
atomic_number: 47,
abbreviation: "Ag",
atomic_weight: 107.87
},
CADMIUM: {
atomic_number: 48,
abbreviation: "Cd",
atomic_weight: 112.40
},
INDIUM: {
atomic_number: 49,
abbreviation: "In",
atomic_weight: 114.82
},
TIN: {
atomic_number: 50,
abbreviation: "Sn",
atomic_weight: 118.69
},
ANTIMONY: {
atomic_number: 51,
abbreviation: "Sb",
atomic_weight: 121.75
},
TELLURIUM: {
atomic_number: 52,
abbreviation: "Te",
atomic_weight: 127.60
},
IODINE: {
atomic_number: 53,
abbreviation: "I",
atomic_weight: 126.904
},
XENON: {
atomic_number: 54,
abbreviation: "Xe",
atomic_weight: 131.30
},
CAESIUM: {
atomic_number: 55,
abbreviation: "Cs",
atomic_weight: 132.905
},
BARIUM: {
atomic_number: 56,
abbreviation: "Ba",
atomic_weight: 137.34
},
LANTHANUM: {
atomic_number: 57,
abbreviation: "La",
atomic_weight: 138.91
},
CERIUM: {
atomic_number: 58,
abbreviation: "Ce",
atomic_weight: 140.12
},
PRASEODYMIUM: {
atomic_number: 59,
abbreviation: "Pr",
atomic_weight: 140.907
},
NEODYMIUM: {
atomic_number: 60,
abbreviation: "Nd",
atomic_weight: 144.24
},
PROMETHIUM: {
atomic_number: 61,
abbreviation: "Pm",
atomic_weight: 147
},
SAMARIUM: {
atomic_number: 62,
abbreviation: "Sm",
atomic_weight: 150.35
},
EUROPIUM: {
atomic_number: 63,
abbreviation: "Eu",
atomic_weight: 151.96
},
GADOLINIUM: {
atomic_number: 64,
abbreviation: "Gd",
atomic_weight: 157.25
},
TERBIUM: {
atomic_number: 65,
abbreviation: "Tb",
atomic_weight: 158.92
},
DYSPROSIUM: {
atomic_number: 66,
abbreviation: "Dy",
atomic_weight: 162.50
},
HOLMIUM: {
atomic_number: 67,
abbreviation: "Ho",
atomic_weight: 164.93
},
ERBIUM: {
atomic_number: 68,
abbreviation: "Er",
atomic_weight: 167.26
},
THULIUM: {
atomic_number: 69,
abbreviation: "Tm",
atomic_weight: 168.93
},
YTTERBIUM: {
atomic_number: 70,
abbreviation: "Yb",
atomic_weight: 173.04
},
LUTETIUM: {
atomic_number: 71,
abbreviation: "Lu",
atomic_weight: 174.97
},
HAFNIUM: {
atomic_number: 72,
abbreviation: "Hf",
atomic_weight: 178.49
},
TANTALUM: {
atomic_number: 73,
abbreviation: "Ta",
atomic_weight: 180.95
},
TUNGSTEN: {
atomic_number: 74,
abbreviation: "W",
atomic_weight: 183.85
},
RHENIUM: {
atomic_number: 75,
abbreviation: "Re",
atomic_weight: 186.2
},
OSMIUM: {
atomic_number: 76,
abbreviation: "Os",
atomic_weight: 190.2
},
OSMIUM: {
atomic_number: 77,
abbreviation: Ir,
atomic_weight: 192.2
},
PLATINUM: {
atomic_number: 78,
abbreviation: "Pt",
atomic_weight: 195.09
},
GOLD: {
atomic_number: 79,
abbreviation: "Au",
atomic_weight: 196.97
},
MERCURY: {
atomic_number: 80,
abbreviation: "Hg",
atomic_weight: 200.59
},
THALLIUM: {
atomic_number: 81,
abbreviation: "Tl",
atomic_weight: 204.37
},
LEAD: {
atomic_number: 82,
abbreviation: "Pb",
atomic_weight: 207.19
},
BISMUTH: {
atomic_number: 83,
abbreviation: "Bi",
atomic_weight: 208.98
},
POLONIUM: {
atomic_number: 84,
abbreviation: "Po",
atomic_weight: 210
},
ASTATINE: {
atomic_number: 85,
abbreviation: "At",
atomic_weight: 211
},
RADON: {
atomic_number: 86,
abbreviation: "Rn",
atomic_weight: 222
},
FRANCIUM: {
atomic_number: 87,
abbreviation: "Fr",
atomic_weight: 223
},
RADIUM: {
atomic_number: 88,
abbreviation: "Ra",
atomic_weight: 226.05
},
ACTINIUM: {
atomic_number: 89,
abbreviation: "Ac",
atomic_weight: 227.05
},
THORIUM: {
atomic_number: 90,
abbreviation: "Th",
atomic_weight: 232.12
},
PROTACTINIUM: {
atomic_number: 91,
abbreviation: "Pa",
atomic_weight: 231.05
},
URANIUM: {
atomic_number: 92,
abbreviation: "U",
atomic_weight: 238.07
},
NEPTUNIUM: {
atomic_number: 93,
abbreviation: "Np",
atomic_weight: 237
},
PLUTONIUM: {
atomic_number: 94,
abbreviation: "Pu",
atomic_weight: 239
},
AMERICIUM: {
atomic_number: 95,
abbreviation: "Am",
atomic_weight: 241
},
CURIUM: {
atomic_number: 96,
abbreviation: "Cm",
atomic_weight: 242
},
BERKELIUM: {
atomic_number: 97,
abbreviation: "Bk",
atomic_weight: 243
},
CALIFORNIUM: {
atomic_number: 98,
abbreviation: "Cf",
atomic_weight: 251
},
EINSTEINIUM: {
atomic_number: 99,
abbreviation: "Es",
atomic_weight: 246
},
FERMIUM: {
atomic_number: 100,
abbreviation: "Fm",
atomic_weight: 250
},
MENDELEVIUM: {
atomic_number: 101,
abbreviation: "Md",
atomic_weight: 256
},
NOBELIUM: {
atomic_number: 102,
abbreviation: "No",
atomic_weight: 254
},
LAWRENCIUM: {
atomic_number: 103,
abbreviation: "Lr",
atomic_weight: 257
},
RUTHERFORDIUM: {
atomic_number: 104,
abbreviation: "Rf",
atomic_weight: 267
},
DUBNIUM: {
atomic_number: 105,
abbreviation: "Db",
atomic_weight: 268
},
SEABORGIUM: {
atomic_number: 106,
abbreviation: "Sg",
atomic_weight: 271
},
BOHRIUM: {
atomic_number: 107,
abbreviation: "Bh",
atomic_weight: NaN
},
HASSIUM: {
atomic_number: 108,
abbreviation: "Hs",
atomic_weight: NaN
},
MEITNERIUM: {
atomic_number: 109,
abbreviation: "Mt",
atomic_weight: NaN
},
DARMSTADTIUM: {
atomic_number: 110,
abbreviation: "Ds",
atomic_weight: NaN
},
ROENTGENIUM: {
atomic_number: 111,
abbreviation: "Rg",
atomic_weight: NaN
},
UNUNBIUM: {
atomic_number: 112,
abbreviation: "Uub",
atomic_weight: NaN
},
UNUNTRIUM: {
atomic_number: 113,
abbreviation: "Uut",
atomic_weight: NaN
},
UNUNQUADIUM: {
atomic_number: 114,
abbreviation: "Uuq",
atomic_weight: NaN
},
UNUNPENTIUM: {
atomic_number: 115,
abbreviation: "Uup",
atomic_weight: NaN
},
LIERMORIUM: {
atomic_number: 116,
abbreviation: "Uuh",
atomic_weight: NaN
},
UNUNPENTIUM: {
atomic_number: 117,
abbreviation: "Uus",
atomic_weight: NaN
},
UNUNPENTIUM: {
atomic_number: 118,
abbreviation: "Uuo",
atomic_weight: NaN
},
UNUNENNIUM: {
atomic_number: 119,
abbreviation: "Uue",
atomic_weight: NaN
},
UNBINILIUM: {
atomic_number: 120,
abbreviation: "Ubn",
atomic_weight: NaN
},
UNBIUNIUM: {
atomic_number: 121,
abbreviation: "Ubu",
atomic_weight: NaN
},
UNBIBIUM: {
atomic_number: 122,
abbreviation: "Ubb",
atomic_weight: NaN
},
UNBITRIUM: {
atomic_number: 123,
abbreviation: "Ubt",
atomic_weight: NaN
},
UNBIQUADIUM: {
atomic_number: 124,
abbreviation: "Ubq",
atomic_weight: NaN
},
UNBIPENTIUM: {
atomic_number: 125,
abbreviation: "Ubp",
atomic_weight: NaN
},
UNBIHEXIUM: {
atomic_number: 126,
abbreviation: "Ubh",
atomic_weight: NaN
},
UNBISEPTIUM: {
atomic_number: 127,
abbreviation: "Ubs",
atomic_weight: NaN
},
UNBIOCTIUM: {
atomic_number: 128,
abbreviation: "Ubo",
atomic_weight: NaN
},
UNBIENNIUM: {
atomic_number: 129,
abbreviation: "Ube",
atomic_weight: NaN
},
UNTRINILIUM: {
atomic_number: 130,
abbreviation: "Utn",
atomic_weight: NaN
},
UNTRINIUM: {
atomic_number: 131,
abbreviation: "Utu",
atomic_weight: NaN
}
};
@jones139
Copy link

Thanks - I was about to create this myself so you saved me a lot of typing!

@bilinkis
Copy link

bilinkis commented Apr 5, 2016

M8, i fucking love you!

@Janatbek
Copy link

but it's not valid json. how do actually parse it? there are missing quotes.

@peterellisjones
Copy link

If anyone came here from Google like me and wants it as actual JSON:

https://gist.github.com/peterellisjones/758549cd18d4665163d8774e6bea6f6b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment