Here was the final answer which was placed in mod_modulename/models/fields/stackexchangesites.php
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
// load the list class
JFormHelper::loadFieldClass('list');
// The class name must always be the same as the filename (in camel case).
// Extend the list class
class JFormFieldStackexchangesites extends JFormFieldList
{
//The field class must know its own type through the variable $type.
protected $type = 'Stackexchangesites';
// declare the function to get options
public function getOptions()
{
// assign JSON to a variable
$json = '{"items":[{"aliases":["http://www.stackoverflow.com","http://facebook.stackoverflow.com"],.....~';
// decode the JSON, and set it as an associative array
$sites = json_decode($json, true);
// set the value of i so we can iterate over it
$i = 0;
// run a foreach on our JSON to get the values for our options
foreach($sites['items'] as $site)
{
// find the api_site_parameter
$stackExchangesSitesOptions[] = $site['api_site_parameter'];
// iterate our i
$i++;
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $stackExchangesSitesOptions);
return $options;
}
}
Finally, in my XML
..~
<config>
<fields name="params">
// add field path so it knows where to look
<fieldset name="basic" addfieldpath="/modules/mod_kou_stack_exchange/models/fields">
..~
// include your field
<field
name="stackexchangesites"
type="stackexchangesites"
label="Stackexchange Sites"
description="JFIELD_TITLE_DESC"
showon="live_or_beta_stackexchange_sites:live"
/>
..~
All the field does is create a dropdown with a list of all the stackexchange sites. The final output of the module loads questions from a stack exchange site based on the user.