title: C++ boost json ptree parser fail to parse string
body: <p>i'm trying to send json messages trough boost message_queue using ptree for storing informations localy.</p>
  
  <p>this is the code of the receiver:</p>
  
  <pre><code>#include &lt;boost/interprocess/ipc/message_queue.hpp&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  //#include &lt;boost/archive/text_iarchive.hpp&gt;
  #include &lt;boost/property_tree/ptree.hpp&gt;
  #include &lt;boost/property_tree/json_parser.hpp&gt;
  #include &lt;boost/serialization/string.hpp&gt;
  using boost::interprocess::message_queue;
  using boost::property_tree::ptree; using boost::property_tree::read_json;
  #define MAX_SIZE 1000
  
  
  
  
  int main()
  {
      message_queue mq (boost::interprocess::open_or_create,"coda",10,MAX_SIZE);
      message_queue::size_type recv_size;
      unsigned int priority;
      ptree pt;
  
      std::stringstream iss;
      std::string serialized_string;
      serialized_string.resize(MAX_SIZE);
      mq.receive(&amp;serialized_string[0],MAX_SIZE,recv_size,priority);
      iss &lt;&lt; serialized_string;
      std::istringstream is(iss.str());
      read_json(is, pt);                                                                                                                                                                                     
  
      std::cout pt.get&lt;std::string&gt;("prefix") &lt;&lt; pt.get&lt;std::string&gt;("faceID") &lt;&lt; std::endl;
  
  }
  </code></pre>
  
  <p>and this is the code of th sender:</p>
  
  <pre><code>#include &lt;boost/interprocess/ipc/message_queue.hpp&gt;
  #include &lt;boost/serialization/string.hpp&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  #include &lt;boost/property_tree/ptree.hpp&gt;
  #include &lt;boost/property_tree/json_parser.hpp&gt;
  using boost::interprocess::message_queue;
  using boost::property_tree::ptree; using boost::property_tree::write_json;
  
  
  #define MAX_SIZE 1000
  
  
  
  void send(ptree pt)
  {
      std::stringstream oss;
      write_json(oss,pt);
  
      std::string serialized_strings(oss.str());
      message_queue mq(boost::interprocess::open_only,"coda");
      mq.send(serialized_strings.data(), serialized_strings.size(),0);
      std::cout &lt;&lt; oss.str() &lt;&lt; std::endl;
  }
  
  int main()                                                                                                                                                                                                 
  {
      ptree pt;
      pt.put("prefix","standard");
      pt.put("faceID",42);
      send(pt);
  }
  </code></pre>
  
  <p>the sender works and have this output:</p>
  
  <pre><code>$ ./sendptree                                                         
  {
      "prefix": "standard",
      "faceID": "42"
  }
  </code></pre>
  
  <p>the receiver  receive the data correctly but fail to parse it (with the read_json call).</p>
  
  <pre><code>$ ./recvptree                                                             
  {
      "prefix": "standard",
      "faceID": "42"
  }
  
  terminate called after throwing an instance of 'boost::exception_detail::clone_impl&lt;boost::exception_detail::error_info_injector&lt;boost::property_tree::json_parser::json_parser_error&gt; &gt;'
    what():  &lt;unspecified file&gt;(5): expected end of input
  [1]    24052 abort      ./recvptree
  </code></pre>