title: Complex linq: Nested where statements JSON.net and linq
body: <p>What I'm trying to accomplish is to select the dateTimeStart inside the ttSheduleDay. The JSON beneath is a node of one employee, the function receives three parameters an empUID, a date and a value of (start / stop or duration). </p>
  
  <p>The node I want to select is where the dsShedule > ttEmployee > empUID equals the first parameter, where the ttShedule > ttSheduleDay > dat equals the date parameter and the third parameter I will execute with an if statement. Below the JSON</p>
  
  <h2>JSON</h2>
  
  <pre><code>{
      "dsShedule": {
          "ttEmployee": [
              {
                  "empUID": 2649,
                  "empNameFirst": "firstname",
                  "empNameLast": "lastname",
                  "empFunction": "employee",
                  "ttShedule": [
                      {
                          "UID": 47,
                          "empUID": 2649,
                          "datStart": "2013-05-20",
                          "datStop": "2013-05-20",
                          "regime": 1,
                          "state": "PLANNED",
                          "ttSheduleDay": [
                              {
                                  "SheduleUID": 47,
                                  "dat": "2013-05-20",
                                  "dateTimeStart": "2013-05-20T08:00:00.000",
                                  "dateTimeStop": "2013-05-20T17:00:00.000",
                                  "duration": 8
                              }
                          ]
                      },
                      {
                          "UID": 57,
                          "empUID": 2649,
                          "datStart": "2013-05-21",
                          "datStop": "2013-05-21",
                          "regime": 1,
                          "state": "PLANNED",
                          "ttSheduleDay": [
                              {
                                  "SheduleUID": 57,
                                  "dat": "2013-05-21",
                                  "dateTimeStart": "2013-05-21T08:00:00.000",
                                  "dateTimeStop": "2013-05-21T17:00:00.000",
                                  "duration": 8
                              }
                          ]
                      }
                  ]
              },
  </code></pre>
  
  <p>The code I already have is to select the ttShedule</p>
  
  <pre><code>JObject jObj = JObject.Parse(json);
  var linq = jObj["dsShedule"]["ttEmployee"]
                  // first filter for a single emp by empUID
                           .First(emp =&gt; emp["empUID"].Value&lt;int&gt;() == Convert.ToInt16(empUID))
                           .SelectToken("ttShedule");
  </code></pre>
  
  <p>The code suggested by someone on Stackoverflow was:</p>
  
  <pre><code>var linq = jObj["dsShedule"]["ttEmployee"]
           // first filter for a single emp by empUID
           .First(emp =&gt; emp["empUID"].Value&lt;int&gt;() == firstUID)
           // then select the ttShedule array of that emp
           .Select(emp =&gt; emp["ttShedule"])
           // now filter for whatever ttShedule you need
           .Where(shed =&gt; shed["ttSheduleDay"]
                        .Any(day =&gt; day["dat"].Value&lt;DateTime&gt;() 
                                               == new DateTime(2013, 5, 24))
  </code></pre>
  
  <p>But this failed on the select statement of ttShedule. I was wondering how i can expand my code to select the dateTimeStart node with the second if statement.</p>
  
  <p>Thanks in advance</p>