Search for a related json data
<p>How can i find data that is related to the already known data?
( I'm a newb. )</p>

<p>For example here is my json : </p>

<pre><code>[ 
{ "id": "1",  "log": "1","pass":  "1111" },
{ "id": 2,  "log": "2","pass":  "2222" },
{ "id": 3, "log": "3","pass":  "3333" }
]
</code></pre>

<p>Now i know that <code>"log"</code> is <code>1</code> and i  want to find out the data <code>"pass"</code> that is related to it.</p>

<p>i've tried to do it so :</p>

<p>The POST request comes with <code>log</code> and <code>pass</code> data , i search the .json file for the same <code>log</code>  value and if there is the same data then i search for related <code>pass</code></p>

<pre><code>fs.readFile("file.json", "utf8", function (err, data) {

                var jsonFileArr = []; 
                jsonFileArr = JSON.parse(data);  // Parse .json objekts

                var log = loginData.log; // The 'log' data that comes with POST request

               /* Search through .json file for the same data*/

               var gibtLog = jsonFileArr.some(function (obj) {
                 return obj.log == log;
                });


                if (gotLog) { // If there is the same 'log'

                    var pass = loginData.pass; // The 'pass' data that comes with POST request

                  var gotPass = jsonFileArr.some(function (obj) {
                    // How to change this part ?
                    return obj.pass == pass;
                });

                }
                else
                    console.log("error");

            });
</code></pre>

<p>The problem is that when i use  </p>

<pre><code>var gotPass = jsonFileArr.some(function (obj) {
                 return obj.pass == pass;
                });
</code></pre>

<p>it searches through the whole .json file and not through only one objekt.</p>