title: Web scraping using select and sorting data with serde crate in rust
body: <p>I'm trying to <strong>scrape</strong> a website using <code>select</code> crate in rust. Here is site structure:</p>
  <pre><code>example.com/category-list/
  
  
  example.com/cat/programming-questions/
  qtitle = &quot;How to become a programmer&quot;
  qid = 2
  
  example.com/cat/networking-questions/
  qtitle = &quot;New question&quot;
  qid = 3
  qtitle = &quot;Other question&quot;
  qid = 4
  </code></pre>
  <h3>Scraper code:</h3>
  <pre class="lang-rust prettyprint-override"><code>
  #[derive(Serialize, Deserialize, Debug)]
  pub struct Question {
      q_title: Vec&lt;String&gt;,
      q_id: Vec&lt;String&gt;,
      q_link: Vec&lt;String&gt;,
  
  }
  
  let mut questions_vector= Vec::new();
  
  for response in reponse_list.iter() {
          let mut q_title: Vec&lt;String&gt; = Vec::new();
          Document::from(resp.as_str())
              .select(Class(&quot;qTitle&quot;))
              .for_each(|f| q_title.push(f.to_string()));
  
  
          let mut q_id: Vec&lt;String&gt; = Vec::new();
          Document::from(resp.as_str())
              .select(Class(&quot;qid&quot;))
              .for_each(|f| q_id.push(f.to_string()));
  
          let mut q_link: Vec&lt;String&gt; = Vec::new();
          Document::from(resp.as_str())
              .select(Name(&quot;a&quot;))
              .filter_map(|f| f.attr(&quot;href&quot;))
              .for_each(|f| q_link.push(f.to_string()));
  
          let question = Question {
              q_title: q_title,
              q_id: q_id,
              q_link: q_link,
  
          };
  
          questions_vector.push(question);
  
  }
  
  println!(&quot;{}&quot;, serde_json::to_string(&amp;questions_vector).unwrap());
  
  </code></pre>
  <h3>Output of my code:</h3>
  <pre class="lang-json prettyprint-override"><code>  {
      &quot;q_title&quot;: [
        &quot;How to become a programmer&quot;,
      ],
      &quot;q_id&quot;: [
        &quot;2&quot;,
      ],
      &quot;q_link&quot;: [
        &quot;https://example.com/q/How-to-become-a-programmer&quot;
      ]
    },
   {
      &quot;q_title&quot;: [
        &quot;New question&quot;,
        &quot;Other question&quot;
      ],
      &quot;q_id&quot;: [
        &quot;3&quot;,&quot;4&quot;
      ],
      &quot;q_link&quot;: [
        &quot;https://example.com/q/New-question&quot;,
        &quot;https://example.com/q/Other-question&quot;
      ]
    }
  </code></pre>
  <h1>Purposed output:</h1>
  <pre class="lang-json prettyprint-override"><code>  {
      &quot;q_title&quot;: [
        &quot;How to become a programmer&quot;,
      ],
      &quot;q_id&quot;: [
        &quot;2&quot;,
      ],
      &quot;q_link&quot;: [
        &quot;https://example.com/q/How-to-become-a-programmer&quot;
      ]
    },
   {
      &quot;q_title&quot;: [
        &quot;New question&quot;,
  
      ],
      &quot;q_id&quot;: [
        &quot;3&quot;,
      ],
      &quot;q_link&quot;: [
        &quot;https://example.com/q/New-question&quot;,
  
      ]
    },
    {
      &quot;q_title&quot;: [
        &quot;Other question&quot;
      ],
      &quot;q_id&quot;: [
        &quot;4&quot;,
      ],
      &quot;q_link&quot;: [
        &quot;https://example.com/q/Other-question&quot;
      ]
    },
  
  </code></pre>
  <p><strong>I need to refactor my code to achieve purposed output</strong></p>