Uncaught SyntaxError: Unexpected token

Uncaught SyntaxError: Unexpected token

Dear all,

I’m facing an issue that seems to be common but I can’t find any solution even after hours of googling.

One of my php script do the following :

  1. <?php
  2. $param = array("fld1" => "firstname",
  3. "fld2" => "lastname");
  4. ?>
  5. <button id="edit-btn" onclick="view_lead_make_editable_field(<?php echo json_encode($param) ?>)">Modifier</button> 

The javascript function is 

  1. function view_lead_make_editable_field(json_param){
  2.     var obj = JSON.parse(json_param);
  3.     alert(obj.count);

But looking at chrome développer tool, I get the following error : Uncaught SyntaxError: Unexpected token ;


What can I do ?