src/Concerns/MakesHttpRequests.php
public function seeJsonStructure(array $structure = null, $responseData = null)
    {
        if (is_null($structure)) {
            return $this->seeJson();
        }

        if (is_null($responseData)) {
            $responseData = $this->decodeResponseJson();
        }

        foreach ($structure as $key => $value) {
            if (is_array($value) && $key === '*') {
                $this->assertIsArray($responseData);

                foreach ($responseData as $responseDataItem) {
                    $this->seeJsonStructure($structure['*'], $responseDataItem);
                }
            } elseif (is_array($value)) {
                $this->assertArrayHasKey($key, $responseData);
                $this->seeJsonStructure($structure[$key], $responseData[$key]);
            } else {
                $this->assertArrayHasKey($value, $responseData);
            }
        }

        return $this;
    }
public function seeJsonStructure(array $structure = null, $responseData = null)
    {
        if (is_null($structure)) {
            return $this->seeJson();
        }

        if (is_null($responseData)) {
            $responseData = $this->decodeResponseJson();
        }

        foreach ($structure as $key => $value) {
            if (is_array($value) && $key === '*') {
                $this->assertIsArray($responseData);

                foreach ($responseData as $responseDataItem) {
                    $this->seeJsonStructure($structure['*'], $responseDataItem);
                }
            } elseif (is_array($value)) {
                $this->assertArrayHasKey($key, $responseData);
                $this->seeJsonStructure($structure[$key], $responseData[$key]);
            } else {
                $this->assertArrayHasKey($value, $responseData);
            }
        }

        return $this;
    }
public function seeJsonStructure ( array $ structure = null , $ responseData = null ) { if ( is_null ( $ structure ) ) { return $ this -> seeJson ( ) ; } if ( is_null ( $ responseData ) ) { $ responseData = $ this -> decodeResponseJson ( ) ; } foreach ( $ structure as $ key => $ value ) { if ( is_array ( $ value ) && $ key === '*' ) { $ this -> assertIsArray ( $ responseData ) ; foreach ( $ responseData as $ responseDataItem ) { $ this -> seeJsonStructure ( $ structure [ '*' ] , $ responseDataItem ) ; } } elseif ( is_array ( $ value ) ) { $ this -> assertArrayHasKey ( $ key , $ responseData ) ; $ this -> seeJsonStructure ( $ structure [ $ key ] , $ responseData [ $ key ] ) ; } else { $ this -> assertArrayHasKey ( $ value , $ responseData ) ; } } return $ this ; }
Assert that the JSON response has a given structure.

@param  array|null  $structure
@param  array|null  $responseData
@return $this
Assert that the JSON response has a given structure .