title: JSON_Spirit: how to get value
body: <p>I am working with cpp to build a project.<br></p>
  
  <p>My project needs a file to do some configuration and I decided to use a file with JSON format. Here is an example:<br></p>
  
  <pre><code>{
      "agentname":"agent1",
      "server":[
          {"ip":"192.168.0.1"},
          {"port":"9999"}
      ]    
  }
  </code></pre>
  
  <p>Now I need to read this file so I use the JSON_Spirit. Here is my code:<br></p>
  
  <pre><code>ifstream conf("config", ios::in);
  json_spirit::mValue mvalue;
  json_spirit::read(conf, mvalue);
  json_spirit::mObject obj = mvalue.get_obj();
  string agentname = obj.find("agentname")-&gt;second.get_str();
  </code></pre>
  
  <p>After the code, I can get <code>agentname</code>.<br>
  But I don't know how to get <code>ip</code> and <code>port</code>.<br>
  I have tried like this:<br></p>
  
  <pre><code>string ip = obj.find("server")-&gt;second.find("ip")-&gt;second.get_str();
  </code></pre>
  
  <p>I think it should be something like this but the code above doesn't work.<br></p>