title: Reading json file with boost
body: <p>I have a file like this:</p>
  
  <p>[data.json]</p>
  
  <pre><code>{
      "electron": {
          "pos": [0,0,0],
          "vel": [0,0,0]
      },
  
      "proton": {
          "pos": [1,0,0],
          "vel": [0,0.1,0]
      },
  
       "proton": {
          "pos": [-1,0,0],
          "vel": [0,-0.1,-0.1]
      }
  }
  </code></pre>
  
  <p>How do I create a vector of particles from parsing this file. As I understand it I need to read the file using boost and read the strings (lines) into a vector, and then parse the contents of the vector.</p>
  
  <p>The class particle is something like this:</p>
  
  <pre><code>class Particle
  {
  
      private:
      particle_type mtype; // particle_type is an enum
      vector&lt;double&gt; mPos;
      vector&lt;double&gt; mVel;
  };
  </code></pre>
  
  <p>Other methods for get/set have been omitted in the class.</p>
  
  <p>Basically I would like help creating a <code>vector&lt;Particle&gt;</code> with the correct position and velocity data and particle_type data parsed into it. Thanks in advance.</p>
  
  <p>Code in main:</p>
  
  <pre><code>int main(){
  
      boost::property_tree::ptree pt;
      boost::property_tree::read_json("data.json", pt);
  }
  </code></pre>