title: Laravel 5.1 PHPUnit Tests for API using JSON
body: <p>I just started working with Unit testing in Laravel 5.1 to test an API I'm building, and I can get PHPUnit to work fine with the ExampleTest.php, but when I create my own test, it fails every time.</p>
  
  <p>Here is the response for my API endpoint <code>v1/conversations</code>:</p>
  
  <pre><code>{
    "data": [
      {
        "id": 1,
        "created_at": "2015-07-05",
        "updated_at": "2015-07-07"
      },
      {
        "id": 2,
        "created_at": "2015-07-06",
        "updated_at": "2015-07-08"
      }
    ]
  }
  </code></pre>
  
  <p>Here is my ConversationsTest.php:</p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Foundation\Testing\WithoutMiddleware;
  use Illuminate\Foundation\Testing\DatabaseMigrations;
  use Illuminate\Foundation\Testing\DatabaseTransactions;
  
  class ConversationsTest extends TestCase
  {
  
      public function test_list_conversations()
      {
          $this-&gt;get('v1/conversations')-&gt;seeJson('data');
      }
  }
  </code></pre>
  
  <p>But when I got to run my test, I get the following: </p>
  
  <pre><code>There was 1 error:
  
  1) ConversationsTest::test_list_conversations
  ErrorException: Argument 1 passed to Illuminate\Foundation\Testing\TestCase::seeJson() must be of the type array, string given
  </code></pre>
  
  <p>Isn't my API returning valid JSON data? Why can't Laravel's <code>seeJson</code> method interpret the response? I've tried to follow the <a href="http://laravel.com/docs/5.1/testing" rel="nofollow">Laravel 5.1 Testing APIs documentation</a>, but I'm clearly missing something...</p>