title: Passing an array of JSON objects to laravel
body: <p>So I have an array containing many JSON objects, This is what it shows in console.log if i output my array:</p>
  
  <pre><code>{"data" :[{"line":"1","band":"X","val":"0"},{"line":"1","band":"A","val":"6461"},{"line":"1","band":"B","val":"6896"},{"line":"1","band":"C","val":"5826"},{"line":"1","band":"D","val":"3704"},{"line":"1","band":"E","val":"2141"},{"line":"1","band":"F","val":"1198"},{"line":"1","band":"G","val":"682"},{"line":"1","band":"H","val":"70"},{"line":"2","band":"X","val":"0"},{"line":"2","band":"A","val":"87"},{"line":"2","band":"B","val":"65"},{"line":"2","band":"C","val":"48"},{"line":"2","band":"D","val":"35"},{"line":"2","band":"E","val":"12"},{"line":"2","band":"F","val":"14"},{"line":"2","band":"G","val":"4"},{"line":"2","band":"H","val":"0"},{"line":"3","band":"X","val":"0"},{"line":"3","band":"A","val":"0"},{"line":"3","band":"B","val":"0"},{"line":"3","band":"C","val":"0"},{"line":"3","band":"D","val":"0"},{"line":"3","band":"E","val":"0"},{"line":"3","band":"F","val":"0"},{"line":"3","band":"G","val":"0"},{"line":"3","band":"H","val":"0"}]}
  </code></pre>
  
  <p>returnObj is outputted above. This is how i build the array to post back to laravel</p>
  
  <pre><code>$('table tr td input').each(function()
  {               
      Obj = 
      {           
          line : $(this).parent().attr('line'),
          band : $(this).parent().attr('band'),
          val : $(this).val()
      }
  
      returnObj.push(Obj);
  
  });
  
  returnObject =  '{"data" :' + JSON.stringify(returnObj) +'}';
  console.log(returnObject);
  </code></pre>
  
  <p>This is my ajax on the page:</p>
  
  <pre><code>$.ajax({ 
  type: "POST", 
  url: "magic/whatif", 
  data : returnObject
  }) 
  .done(function(response) 
  { 
      alert(response); 
  });
  </code></pre>
  
  <p>There is no problem with my routes or logic, I simply print_r or echo the data that was passed in as the response so i can see what laravel does with it.</p>
  
  <pre><code>$data = Input::all(); 
  print_r($data);
  </code></pre>
  
  <p>The problem is laravel can not handle the array of objects so it sends back this:</p>
  
  <pre><code>Array ( [undefined] =&gt; )
  </code></pre>
  
  <p>There are many solutions and I had it working when you just pass a single JSON object to laravel but i need to pass an array containing many JSON objects to laravel from the view.</p>