my $RecType=uc($q->param('SearchRecType')); my $RecSubType=uc($q->param('SearchRecSubType')); my $SQL = "SELECT OBJ_ID,TITLE FROM OBJTBL"; $sth = $dbh->prepare($SQL); $sth->execute() or die "Can't execute Statement: $dbh->DBI::errstr"; my @rows; while ( my $row = $sth->fetchrow_hashref ) { push @rows, $row; } print $q->header( 'application/json' ); print encode_json( { results => \@rows } ); #### {"results":[{"TITLE":"Title 1"OBJ_ID":"1"},{"TITLE":"Title 2","OBJ_ID":"2"}]}