title: How can I add string pairs to a document of rapidjson
body: <p>I want to create a json string using rapidjson. But I got a error: unable to convert <code>std::string</code> to <code>rapidjson::Type</code>.</p>
  
  <pre><code>int x = 111;
  string className = "myclass";
  
  Document doc;
  auto&amp; allocator = doc.GetAllocator();
  
  doc.AddMember("x", Value().SetInt(x), allocator);
  doc.AddMember("className", className, allocator);
  
  unordered_map&lt;string, string&gt;&amp; map = sprite-&gt;toMap();
  for (const auto&amp; pair : map) {
      Value key(pair.first.c_str(), pair.first.size(), allocator);
      doc.AddMember(key, pair.second, allocator);
  }
  
  StringBuffer sb;
  Writer&lt;StringBuffer&gt; writer(sb);
  
  doc.Accept(writer);
  log("json string: %s", sb.GetString());
  </code></pre>