title: How to make boost ptree parse xml and json the same way?
body: <p>So lets take a look onto a littel bit modified <a href="http://www.boost.org/doc/libs/1_41_0/doc/html/boost_propertytree/tutorial.html" rel="nofollow">example</a> code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;boost/foreach.hpp&gt;
  #include &lt;boost/property_tree/ptree.hpp&gt;
  #include &lt;boost/property_tree/xml_parser.hpp&gt;
  
  void load(const std::string &amp;file_path)
  {
      using boost::property_tree::ptree;
      ptree pt;
      std::ifstream script;
      script.open(file_path.c_str());
      read_xml(script, pt);
      BOOST_FOREACH(boost::property_tree::ptree::value_type &amp;v,
                    config.get_child("config.servecies"))
      {
          std::cout
              &lt;&lt; "First data: " &lt;&lt; v.first.data() &lt;&lt; std::endl
              &lt;&lt; "Second data: " &lt;&lt; v.second.data() &lt;&lt; std::endl;
      }
  
  }
  </code></pre>
  
  <p>I try it on with such xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;config&gt;
      &lt;servecies&gt;
          &lt;module&gt;file&lt;/module&gt;
          &lt;module&gt;Admin&lt;/module&gt;
          &lt;module&gt;HR&lt;/module&gt;
          &lt;notModule&gt;MyNotModule&lt;/notModule&gt;
      &lt;/servecies&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>it prints:</p>
  
  <blockquote>
    <p>First data: module<br>
    Second data: file<br>
    First data: module<br>
    Second data: Admin<br>
    First data: module<br>
    Second data: HR<br>
    First data: notModule<br>
    Second data: MyNotModule</p>
  </blockquote>
  
  <p>But when I try such json file (created from this xml via <a href="http://jsontoxml.utilities-online.info/" rel="nofollow">this web tool</a>):</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "config": {
      "name": "myconfig",
      "servecies": {
        "module": [
          "file",
          "Admin",
          "HR"
        ],
        "notModule": "MyNotModule"
      }
    }
  }
  </code></pre>
  
  <p>it prints:</p>
  
  <blockquote>
    <p>First data: module<br>
    Second data:<br>
    First data: notModule<br>
    Second data: MyNotModule</p>
  </blockquote>
  
  <p>How to make boost property_tree produce same results on JSON as it parses XML? How to find out if value_type is some sort of one dimentional array and iterate thru it?</p>