Pathfinder Equipment in JSON Form

While reading through the Pathfinder Core Rule book I notice there is a specific way to randomly generate magic items for town shops.

I thought about possibly creating some code to generate magic items. However, to start I needed the basic data found in the rule book for equipment.

Below I give you a JSON file I created of the SRD 3.5 equipment:

In [1]: from urllib2 import urlopen

In [2]: from json import loads

In [3]: data = urlopen('https://nessy.info/equipment.json')

In [4]: equipment = loads(data.read())

This JSON if a list of multiple equipment items, each item has attribute keys for stuff like cost, reference, and name:

In [1]: len(equipment)
Out[1]: 282

In [2]: equipment[0]
Out[2]:
{u'category': u'Item',
 u'cost': u'1 cp',
 u'family': u'Trade Goods',
 u'full_text': None,
 u'name': u'One pound of wheat',
 u'reference': u'SRD 3.5 Equipment'}

Using a small python list comprehension we can get items by name:

In [9]: [ i for i in equipment if i['name'] == 'Longsword' ]
Out[9]:
[{u'category': u'Martial Weapons',
u'cost': u'15 gp',
u'critical': u'19-20/x2',
u'dmg_m': u'1d8',
u'dmg_s': u'1d6',
u'family': u'Weapons',
u'full_text': None,
u'name': u'Longsword',
u'range_increment': u'-',
u'reference': u'SRD 3.5 Equipment',
u'subcategory': u'One-Handed Melee Weapons',
u'type': u'Slashing',
u'weight': u'4 lb.'}]

And a list of each item name in this JSON can be displayed like so:

In [1]: [ i['name'] for i in equipment ]
Out[1]:
[u'One pound of wheat',
u'One pound of flour, or one chicken',
u'One pound of iron',
u'One pound of tobacco or copper',
u'One pound of cinnamon, or one goat',
u'One pound of ginger or pepper, or one sheep',
u'One pig',
u'One square yard of linen',
u'One pound of salt or silver',
u'One square yard of silk, or one cow',
u'One pound of saffron or cloves, or one ox',
u'One pound of gold',
u'One pound of platinum',
u'Gauntlet',
u'Unarmed strike',
u'Dagger',
u'Dagger, punching',
u'Gauntlet, spiked',
u'Mace, light',
u'Sickle',
u'Club',
u'Mace, heavy',
u'Morningstar',
u'Shortspear',
u'Longspear',
u'Quarterstaff',
u'Spear',
u'Crossbow, heavy',
u'Bolts, crossbow (10)',
u'Crossbow, light',
u'Dart',
u'Javelin',
u'Sling',
u'Bullets, sling (10)',
u'Axe, throwing',
u'Hammer, light',
u'Handaxe',
u'Kukri',
u'Pick, light',
u'Sap',
u'Shield, light',
u'Spiked armor',
u'Spiked shield, light',
u'Sword, short',
u'Battleaxe',
u'Flail',
u'Longsword',
u'Pick, heavy',
u'Rapier',
u'Scimitar',
u'Shield, heavy',
u'Spiked shield, heavy',
u'Trident',
u'Warhammer',
u'Falchion',
u'Glaive',
u'Greataxe',
u'Greatclub',
u'Flail, heavy',
u'Greatsword',
u'Guisarme',
u'Halberd',
u'Lance',
u'Ranseur',
u'Scythe',
u'Longbow',
u'Arrows (20)',
u'Longbow, composite',
u'Shortbow',
u'Shortbow, composite',
u'Kama',
u'Nunchaku',
u'Sai',
u'Siangham',
u'Sword, bastard',
u'Waraxe, dwarven',
u'Whip',
u'Axe, orc double',
u'Chain, spiked',
u'Flail, dire',
u'Hammer, gnome hooked',
u'Sword, two-bladed',
u'Urgrosh, dwarven',
u'Bolas',
u'Crossbow, hand',
u'Bolts (10)',
u'Crossbow, repeating heavy',
u'Bolts (5)',
u'Crossbow, repeating light',
u'Net',
u'Shuriken (5)',
u'Padded',
u'Leather',
u'Studded leather',
u'Chain shirt',
u'Hide',
u'Scale mail',
u'Chainmail',
u'Breastplate',
u'Splint mail',
u'Banded mail',
u'Half-plate',
u'Full plate',
u'Buckler',
u'Shield, light wooden',
u'Shield, light steel',
u'Shield, heavy wooden',
u'Shield, heavy steel',
u'Shield, tower',
u'Armor spikes',
u'Gauntlet, locked',
u'Shield spikes',
u'Backpack (empty)',
u'Barrel (empty)',
u'Basket (empty)',
u'Bedroll',
u'Bell',
u'Blanket, winter',
u'Block and tackle',
u'Bottle, wine, glass',
u'Bucket (empty)',
u'Caltrops',
u'Candle',
u'Canvas (sq. yd.)',
u'Case, map or scroll',
u'Chain (10 ft.)',
u'Chalk, 1 piece',
u'Chest (empty)',
u'Crowbar',
u'Firewood (per day)',
u'Fishhook',
u'Fishing net, 25 sq. ft.',
u'Flask (empty)',
u'Flint and steel',
u'Grappling hook',
u'Hammer',
u'Ink (1 oz. vial)',
u'Inkpen',
u'Jug, clay',
u'Ladder, 10-foot',
u'Lamp, common',
u'Lantern, bullseye',
u'Lantern, hooded',
u'Lock, Very simple',
u'Lock, Average',
u'Lock, Good',
u'Lock, Amazing',
u'Manacles',
u'Manacles, masterwork',
u'Mirror, small steel',
u'Mug/Tankard, clay',
u'Oil (1-pint flask)',
u'Paper (sheet)',
u'Parchment (sheet)',
u"Pick, miner's",
u'Pitcher, clay',
u'Piton',
u'Pole, 10-foot',
u'Pot, iron',
u'Pouch, belt (empty)',
u'Ram, portable',
u'Rations, trail (per day)',
u'Rope, hempen (50 ft.)',
u'Rope, silk (50 ft.)',
u'Sack (empty)',
u'Sealing wax',
u'Sewing needle',
u'Signal whistle',
u'Signet ring',
u'Sledge',
u'Soap (per lb.)',
u'Spade or shovel',
u'Spyglass',
u'Tent',
u'Torch',
u'Vial, ink or potion',
u'Waterskin',
u'Whetstone',
u'Acid (flask)',
u"Alchemist's fire (flask)",
u'Antitoxin (vial)',
u'Everburning torch',
u'Holy water (flask)',
u'Smokestick',
u'Sunrod',
u'Tanglefoot bag',
u'Thunderstone',
u'Tindertwig',
u"Alchemist's lab",
u"Artisan's tools",
u"Artisan's tools, masterwork",
u"Climber's kit",
u'Disguise kit',
u"Healer's kit",
u'Holly and mistletoe',
u'Holy symbol, wooden',
u'Holy symbol, silver',
u'Hourglass',
u'Magnifying glass',
u'Musical instrument, common',
u'Musical instrument, masterwork',
u"Scale, merchant's",
u'Spell component pouch',
u"Spellbook, wizard's (blank)",
u"Thieves' tools",
u"Thieves' tools, masterwork",
u'Tool, masterwork',
u'Water clock',
u"Artisan's outfit",
u"Cleric's vestments",
u'Cold weather outfit',
u"Courtier's outfit",
u"Entertainer's outfit",
u"Explorer's outfit",
u"Monk's outfit",
u"Noble's outfit",
u"Peasant's outfit",
u'Royal outfit',
u"Scholar's outfit",
u"Traveler's outfit",
u'Ale, Gallon',
u'Ale, Mug',
u'Banquet (per person)',
u'Bread, per loaf',
u'Cheese, hunk of',
u'Inn stay (per day), Good',
u'Inn stay (per day), Common',
u'Inn stay (per day), Poor',
u'Meals (per day), Good',
u'Meals (per day), Common',
u'Meals (per day), Poor',
u'Meat, chunk of',
u'Wine, Common (pitcher)',
u'Wine, Fine (bottle)',
u'Barding, Medium creature',
u'Barding, Large creature',
u'Bit and bridle',
u'Dog, guard',
u'Dog, riding',
u'Donkey or mule',
u'Feed (per day)',
u'Horse, heavy',
u'Horse, light',
u'Horse, Pony',
u'Horse, Warhorse, heavy',
u'Horse, Warhorse, light',
u'Horse, Warpony',
u'Saddle, Military',
u'Saddle, Pack',
u'Saddle, Riding',
u'Saddle, Exotic, Military',
u'Saddle, Exotic, Pack',
u'Saddle, Exotic, Riding',
u'Saddlebags',
u'Stabling (per day)',
u'Carriage',
u'Cart',
u'Galley',
u'Keelboat',
u'Longship',
u'Rowboat',
u'Oar',
u'Sailing ship',
u'Sled',
u'Wagon',
u'Warship',
u'Coach cab',
u'Hireling, trained',
u'Hireling, untrained',
u'Messenger',
u'Road or gate toll',
u"Ship's passage",
u'Spell, 0-level',
u'Spell, 1st-level',
u'Spell, 2nd-level',
u'Spell, 3rd-level',
u'Spell, 4th-level',
u'Spell, 5th-level',
u'Spell, 6th-level',
u'Spell, 7th-level',
u'Spell, 8th-level',
u'Spell, 9th-level']