title: rapidjson pretty print using JSON string as input to the writer
body: <p>Following <a href="http://rapidjson.org/md_doc_sax.html#Writer" rel="nofollow noreferrer">rapidjson documentation</a> I'm able to generate a pretty-printed JSON ouput writting in a key-by-key approach, e.g.:</p>
  
  <pre><code>rapidjson::StringBuffer s;
  rapidjson::PrettyWriter&lt;rapidjson::StringBuffer&gt; writer(s);    
  
  writer.StartObject();
  writer.Key("hello");
  writer.String("world");
  writer.EndObject();
  
  std::string result = s.GetString();
  </code></pre>
  
  <p>However, I would like to do the same but using a JSON string (i.e. a <code>std::string</code> object which content is a valid JSON) to feed the writer, instead of calling <code>Key()</code>, <code>String()</code> and so.</p>
  
  <p>Looking to the <a href="http://rapidjson.org/classrapidjson_1_1_pretty_writer.html" rel="nofollow noreferrer"><code>PrettyWriter</code> API</a> I don't see any method to pass a JSON string in that way. An alternative would be to pass the parsed JSON string as a <code>rapidjson::Document</code> object, but I haven't found that possibility.</p>
  
  <p>Any idea about how this could be done, please?</p>