JSONArray items;
String cur_title;
PImage img;
int idx;

void setup()
{
  size( 600, 400 );

  JSONObject obj = loadJSONObject( "radiolab.json" );
  items = obj.getJSONArray( "items" );
  idx = 0;
  setView();

  textSize( 24 );
}

void draw()
{
  background( 80 );
  fill( 255 );
  text( cur_title, 120, 50, 450, 200 );
  if ( img != null ) {
    image( img, 0, 0, 100, 100 );
  }
}

void setView()
{
  JSONObject episode = items.getJSONObject( idx );

  cur_title = episode.getString( "title" );
  img = loadImage( episode.getString( "thumbnail" ) );
}

void keyPressed()
{
  if ( keyCode == RIGHT ) {
    idx = idx + 1;
    if ( idx >= items.size() ) {
      idx = 0;
    }
    setView();
  }
}