Unable to access PHP array in javascript, javascript object initalized to array ends up empty in chrome developer tools
===

I'm trying to get a JSON from PHP array so I can overlay the JSON on to a google charts geochart. So I am trying to get this working by using this simple code in test.php file

    <?php 
      include("conn.php");
    ?>

    <!DOCTYPE html>
    <html>
    <head>
      <title>test</title>
    </head>
    <body>

    <script type="text/javascript">
      document.onload = function (){
        var jsonObj = <?php echo json_encode($rowarr, JSON_FORCE_OBJECT); ?>;
        var jsonString = JSON.stringify(jsonObj, null, '\n');
        console.log(jsonString);
      };
      
    </script>
    </body>
    </html>

The conn.php file returns an array like so 

    {"Auckland":37616,"Wellington":35357,"Christchurch":29818}

But in the chrome developer tools I see that this code appears as 

    document.onload = function (){
    var jsonObj = ;
        // Chrome error here -> Uncaught SyntaxError: Unexpected token ;
    var jsonString = JSON.stringify(jsonObj, null, '\n');

The jsonObj variable is empty, when there should be something in it. 

On the CDT console I get

    Uncaught SyntaxError: Unexpected token ; 

at line 11 in this test.php file