past a object from php to javascript : i have a little bit probleme , i need to give a object at JS when a click on a button , but i don t know how to do

here is my code php 

     echo '<script>';
    	echo 'var monObjet = "'.json_encode($product).'";';
         echo '<script>';
    <button type="button" onclick="ShowModal(monObjet)" class="btn btn-info btn-lg" data-toggle="modal" >Open Modal</button>';

and this is my code JS

    function ShowModal(monObjet){
        
        var monObjet = monObjet;
        alert(monObjet);
        
        $('#myModal').appendTo("body").modal("show");
        
       // $('#NomProduit').text(monObjet);
          
        
       
      
    };
    </script>

thanks in advance 