title: how to update an array using rapidjson?
body: <p>i doing some stuff with rapidjson and i want to add values to an array i just created like that </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "rapidjson/document.h"
  using namespace std ;
  
  int main() {
  
  
      char json[1024];
      rapidjson::Document document ;
      document.Parse&lt;0&gt;(json);
      if (!document.IsObject()) {
              document.SetObject();
      }
      assert(document.IsObject());
      rapidjson::Document::AllocatorType&amp; allocator = document.GetAllocator();
      // adding member (int)
      document.AddMember("mohammed",25,allocator);
      assert(document.HasMember("mohammed"));
      cout &lt;&lt; document["mohammed"].GetInt() &lt;&lt; endl ;
  
      // adding member (array)
      rapidjson::Value array(rapidjson::kArrayType);
      array.PushBack(5,allocator);
      array.PushBack(6,allocator);
      cout &lt;&lt; array[0u].GetInt() &lt;&lt; endl ;
      cout &lt;&lt; array[1].GetInt() &lt;&lt; endl ;
      document.AddMember("array",array,allocator);
      assert(document.HasMember("array"));
      assert(document["array"].IsArray());
      // here the following line give me an error 
      array.PushBack(7,allocator);
  
  
  
  
  }
  </code></pre>
  
  <p>the error is </p>
  
  <pre><code>json: rapidjson/document.h:397: rapidjson::GenericValue&lt;Encoding, Allocator&gt;&amp; rapidjson::GenericValue&lt;Encoding, Allocator&gt;::PushBack(rapidjson::GenericValue&lt;Encoding, Allocator&gt;&amp;, Allocator&amp;) [with Encoding = rapidjson::UTF8&lt;&gt;; Allocator = rapidjson::MemoryPoolAllocator&lt;&gt;]: Assertion `IsArray()' failed.
  </code></pre>
  
  <p>Aborted (core dumped)</p>
  
  <p>what is the problem can someone explain? what is happening i am kinda new to this,thank you.</p>