title: How to extract complete string from JSON using ptree.get_child in cpp?
body: <p>Json File</p>
  <pre><code>{
   &quot;a&quot; : &quot;Hello&quot;,
   &quot;b&quot; : {
     &quot;c&quot; : &quot;World&quot;,
     &quot;d&quot; : [&quot;Hello&quot;,&quot;World&quot;]
   }
  }
  </code></pre>
  <p>This is the following code I've written</p>
  <pre><code>    //ruleString = Json Content;
      using namespace boost::property_tree;
      std::stringstream sStream(ruleString);
      ptree pt;
      read_json(sStream, pt);
      std::string v0 = pt.get&lt;std::string&gt;(&quot;a&quot;);
      const ptree&amp; b = pt.get_child(&quot;b&quot;);
      std::string re = &quot;&quot;;
      for(const auto&amp; kv : b) {
          re = re + kv.first + &quot;:&quot; + kv.second.get_value&lt;std::string&gt;()+&quot;,&quot;;
      }
  </code></pre>
  <p>For above code snippet I get proper output for <code>v0, ie v0 = &quot;Hello&quot;</code>
  However for <code>re, I get output as c:World, d:</code></p>
  <p>I want output of re to be</p>
  <pre><code>&quot;c&quot; : &quot;World&quot;,
  &quot;d&quot; : [&quot;Hello&quot;,&quot;World&quot;]
  </code></pre>