src/HelperTrait.php
public static function assertInJson(string $needle, array $haystack, string $msg = '')
    {
        if ($msg === '') {
            $msg = "Expected the array to contain the element '$needle'.";
        }

        $array = json_decode($needle, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidArgumentException("Invalid json provided: '$needle'.");
        }

        static::assertArraySubset($haystack, $array, false, $msg);
    }
public static function assertInJson(string $needle, array $haystack, string $msg = '')
    {
        if ($msg === '') {
            $msg = "Expected the array to contain the element '$needle'.";
        }

        $array = json_decode($needle, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidArgumentException("Invalid json provided: '$needle'.");
        }

        static::assertArraySubset($haystack, $array, false, $msg);
    }
public static function assertInJson ( string $ needle , array $ haystack , string $ msg = '' ) { if ( $ msg === '' ) { $ msg = "Expected the array to contain the element '$needle'." ; } $ array = json_decode ( $ needle , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new InvalidArgumentException ( "Invalid json provided: '$needle'." ) ; } static :: assertArraySubset ( $ haystack , $ array , false , $ msg ) ; }
Assert that the element exists in the json.

@param string $needle
@param array  $haystack
@param string $msg

@throws \InvalidArgumentException

@return void
Assert that the element exists in the json .