src/Concerns/MakesHttpRequests.php
protected function seeJsonContains(array $data, $negate = false)
    {
        $method = $negate ? 'assertFalse' : 'assertTrue';

        $actual = json_encode(Arr::sortRecursive(
            (array) $this->decodeResponseJson()
        ));

        foreach (Arr::sortRecursive($data) as $key => $value) {
            $expected = $this->formatToExpectedJson($key, $value);

            $this->{$method}(
                Str::contains($actual, $expected),
                ($negate ? 'Found unexpected' : 'Unable to find').' JSON fragment'.PHP_EOL."[{$expected}]".PHP_EOL.'within'.PHP_EOL."[{$actual}]."
            );
        }

        return $this;
    }
protected function seeJsonContains(array $data, $negate = false)
    {
        $method = $negate ? 'assertFalse' : 'assertTrue';

        $actual = json_encode(Arr::sortRecursive(
            (array) $this->decodeResponseJson()
        ));

        foreach (Arr::sortRecursive($data) as $key => $value) {
            $expected = $this->formatToExpectedJson($key, $value);

            $this->{$method}(
                Str::contains($actual, $expected),
                ($negate ? 'Found unexpected' : 'Unable to find').' JSON fragment'.PHP_EOL."[{$expected}]".PHP_EOL.'within'.PHP_EOL."[{$actual}]."
            );
        }

        return $this;
    }
protected function seeJsonContains ( array $ data , $ negate = false ) { $ method = $ negate ? 'assertFalse' : 'assertTrue' ; $ actual = json_encode ( Arr :: sortRecursive ( ( array ) $ this -> decodeResponseJson ( ) ) ) ; foreach ( Arr :: sortRecursive ( $ data ) as $ key => $ value ) { $ expected = $ this -> formatToExpectedJson ( $ key , $ value ) ; $ this -> { $ method } ( Str :: contains ( $ actual , $ expected ) , ( $ negate ? 'Found unexpected' : 'Unable to find' ) . ' JSON fragment' . PHP_EOL . "[{$expected}]" . PHP_EOL . 'within' . PHP_EOL . "[{$actual}]." ) ; } return $ this ; }
Assert that the response contains the given JSON.

@param  array  $data
@param  bool  $negate
@return $this
Assert that the response contains the given JSON .