Populate two arrays with two different SQL queries
There are two possible answers to this question, a generalized one and a specific one.

To help with such questions in general, there is one programming concept which is often underestimated by PHP users. It is called user-defined functions

In a nutshell, you can write a code once and then use it any number of times.

function getArrayFromSql($db, $sql)
{
    $db-&gt;setQuery($sql);
    $rows = $db-&gt;loadRowList();
    $output = array();
    foreach ($rows as $row) {
        array_push($output, $row);
    }
    return $data;
}


Here you created a function which you can use any number of times:

$sql = "Select ranchstyle from information";
$output = getArrayFromSql($db, $sql);
$data = json_encode($output[0]);

$sql = "Select maestro from musicinfo";
$output = getArrayFromSql($db, $sql);
$data1 = json_encode($output[0]);


Whereas for the specific answer we need to review your code more closely. It does unnecessary job all the time.

First, you are making a useless call to $db->getQuery(true);, as with the very next step the $sql variable gets overwritten.

Second, you actually have an array already, as $db->loadRowList(); gives you a first class array. But for some reason you are duplicating it into $data. So your code actually should be

$sql = "Select ranchstyle from information";
$db-&gt;setQuery($sql);
$rows = $db-&gt;loadRowList();
$data = json_encode($rows[0]);

$sql = "Select maestro from musicinfo";
$db-&gt;setQuery($sql);
$rows = $db-&gt;loadRowList();
$data1 = json_encode($rows[0]);


Third, given you are encoding only the first item of the array, you seems don't need an array at all, so select and fetch one line only. 

$sql = "Select ranchstyle from information limit 1";
$db-&gt;setQuery($sql);
$row = $db-&gt;loadRow();
$data = json_encode($row);

$sql = "Select maestro from musicinfo limit 1";
$db-&gt;setQuery($sql);
$row = $db-&gt;loadRow();
$data1 = json_encode($row);