title: Prepare JSON data for bootstrap treeview in C#(MVC4)
body: <p>Hi my <strong>requirement</strong> is show user details in <strong><em>boot strap treeview</em></strong></p>
  
  <p>here i am getting user data through linq query from  SQL database </p>
  
  <p>this is sample JSON data in this way how to prepare data in C#  </p>
  
  <p><strong>NOTE:</strong> bootstrap treeview will work only with those key names should be same as mentioned in data <strong>text</strong> and <strong>nodes</strong> but in my c# class i have different field names <strong>as shown in below screen shot</strong>   <a href="https://i.stack.imgur.com/5vNzZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5vNzZ.png" alt="I need to show like this"></a>  <a href="https://i.stack.imgur.com/hEeE8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hEeE8.png" alt="enter image description here"></a>  </p>
  
  <p><strong>Sample JSON Data</strong> <strong>-->  how to prepare data like this in C#</strong></p>
  
  <pre><code>var treeData = [{
              text: "UserName 1", nodes: [ {
                  text: "First Name1"
              },
         {
             text: "Last Name1"
         },
         {
             text: "User Orders 1",
             nodes: [
               {
                   text: "Order 1"
               },
               {
                   text: "Order 2"
               }
             ]
         },
         {
             text: "User Locations 1",
             nodes: [
               {
                   text: "Location 1"
               },
               {
                   text: "Location 2"
               }
             ]
         }
  
              ]
          },
         {
             text: "UserName 2", nodes: [{
                 text: "First Name 2"
             },
        {
            text: "Last Name 2"
        },
        {
            text: "User Orders 2",
            nodes: [
              {
                  text: "Order 1"
              },
              {
                  text: "Order 2"
              }
            ]
        },
        {
            text: "User Locations 2",
            nodes: [
              {
                  text: "Location 1"
              },
              {
                  text: "Location 2"
              }
            ]
        }
  
             ]
         }
          ];
  </code></pre>