title: How do I pass a JSON array into the URL?
body: <h2>JavaScript/JQuery</h2>
  
  <pre><code>var arr=[];
  
  $('.element').each(function(i)
  {
      arr.push({"id":i,"value":$(this).attr('data-value')});
  });
  
  $.get('/json.php?arr='+arr,function(result)
  {
      alert(result);
  });
  </code></pre>
  
  <h2>PHP</h2>
  
  <pre><code>&lt;?php
  
  $j = json_decode($_GET['arr'], true);
  
  foreach($j as $k =&gt; $v)
  {
      echo $v['id'].':'.$v['value'].'&lt;br /&gt;';
  }
  
  ?&gt;
  </code></pre>
  
  <h2>Problem</h2>
  
  <p>But the problem is that the URL looks like <code>/json.php?arr=[object Object],[object Object]</code> instead of <code>/json.php?arr=[{"id":1,"value":"value 1"},{"id":2,"value":"value 2"}]</code>. Do I need to convert the object to a string? But I don't want to use another library other than JQuery. Is this possible? :/</p>