title: One to many database to json
body: <p>I got stuck when I retrieve data from database that is one to many relationship and I get two rows like this</p>
  
  <pre><code>ID   NAME   CHOICE_ID CHOICE_NAME CHOICE_VALUE
  1     1         1          1          true
  1     1         1          2          false
  </code></pre>
  
  <p>How can I make a json like this?</p>
  
  <pre><code>[{
      id:1
      name:1
      choice:[
            {
             choiceId:1
             choiceName:1
             choice_value:true
            },
            {
             choiceId:1
             choiceName:2
             choiceValue:false
             }
        ]
  ]}
  </code></pre>
  
  <p>My code is like :</p>
  
  <pre><code> var tbl = from a in db.users
             join b in db.choice
             on a.choice_id = b.choice_id
  
             select new {
               a.id
               a.name
               a.choice_id
               b.choice_name
               b.choice_value
             }
  
          table.Select(p =&gt; new User()
          {
             id = p.id
             name = p.name
             choice = new List&lt;Choice&gt;()
             {
               new Choice()
               {
                 choiceId = p.choiceId
                 choiceName = p.choiceName
                 choiceValue = p.choiceValue
               }
             }
          }).toList();
  </code></pre>
  
  <p>It's will get two with the same id and name I want to get one that contain all choice.</p>