title: How to pass JSON object to a javascript function
body: <p>I have a JSON object representing a hierarchy of digital wallets:</p>
  
  <pre><code>masterWallets = {wallet: {}, childs: [{}, {}, ..., {}]}
  </code></pre>
  
  <p>the array of childs are other wallets which can contains other wallets... (like a file system).</p>
  
  <p>Here is my html table:</p>
  
  <pre><code>&lt;% masterWallets.forEach(function(masterWallet) { %&gt;
        &lt;tr&gt;
          &lt;td&gt;masterWallet.wallet.walletName&lt;/td&gt;
          &lt;td&gt;&lt;%= JSON.stringify(masterWallet.childs) %&gt;&lt;/td&gt;
          &lt;td&gt;
             &lt;script&gt;
               document.write(window.getChilds( &lt;%= masterWallet.childs %&gt; ));
             &lt;/script&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
  &lt;% }); %&gt;
  </code></pre>
  
  <p>I would like to pass the array of child wallets (masterWallet.childs) to a function and extract and print some infos. I can see all the childs with:
      &lt;%= JSON.stringify(mWallet.childs) %>
  But I can't pass this variable to my function. I have in the javascript console:</p>
  
  <pre><code>document.write(window.getChilds( [object Object],[object Object] ));
  </code></pre>
  
  <p>with this error:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected identifier
  </code></pre>
  
  <p>Question: How do I pass a JSON object (or an array of JSON objects ?) to a function ? </p>