I am having difficulty to read username and password from external json file. I want to match username and password from user inputs with json username and password.Can anyone help me please? Thanks

my.json

```
[
  {
    "username":"user@email.com",
    "password":"123456"
  },
  {
    "username":"newuser@email.com",
    "password":"98765"
  }
]

```

php codde

```
$username = $_POST['username'];
        $password = $_POST['password'];
        $JSON = file_get_contents("my.json");
        $jsonIterator = new RecursiveIteratorIterator(
                        new RecursiveArrayIterator(json_decode($JSON, TRUE)),
                        RecursiveIteratorIterator::SELF_FIRST);

       foreach ($jsonIterator as $key => $val) {

        if($val==$username &&  $val == $password) {
            print "found";
            $_SESSION['signin'] = $username

        }

```