title: how to use mongoimport to import a json file
body: <p>I'm trying to import a json file using <code>mongoimport</code> with this command line:</p>
  
  <pre><code>mongoimport --db posts --collection rows --file post_history.json
  </code></pre>
  
  <p>but it returns this error:</p>
  
  <pre><code>connected to: localhost
  Failed: error processing document #1: invalid character 'N' after object key:value pair
  imported 0 documents
  </code></pre>
  
  <p>The content of the file looks like this:</p>
  
  <pre><code>[
   {
   "Id" : 1,
   "PostHistoryTypeId" : 2,
   "PostId" : 1,
   "RevisionGUID" : "1e04af17-3bdb-4263-aa46-97ee7fb1b0b6",
   "CreationDate" : "2011-06-21 20:19:34",
   "UserId" : 9,
   "Text" : "My finance and myself are looking for a good Caribbean cruise in October and were wondering which islands are best to see and which Cruise line to take?"
   },
   {
   "Id" : 2,
   "PostHistoryTypeId" : 1,
   "PostId" : 1,
   "RevisionGUID" : "1e04af17-3bdb-4263-aa46-97ee7fb1b0b6",
   "CreationDate" : "2011-06-21 20:19:34",
   "UserId" : 9,
   "Text" : "What's the best Caribbean cruise for October"
   },
   {
   "Id" : 3,
   "PostHistoryTypeId" : 3,
   "PostId" : 1,
   "RevisionGUID" : "1e04af17-3bdb-4263-aa46-97ee7fb1b0b6",
   "CreationDate" : "2011-06-21 20:19:34",
   "UserId" : 9,
   "Text" : "&lt;caribbean&gt;&lt;cruising&gt;&lt;vacation&gt;"
   },
   {
   "Id" : 4,
   "PostHistoryTypeId" : 2,
   "PostId" : 2,
   "RevisionGUID" : "58500a29-b9ed-4802-9934-c173ce362758",
   "CreationDate" : "2011-06-21 20:22:33",
   "UserId" : 13,
   "Text" : "This was one of our definition questions, but also one that interests me personally: How can I find a guide that will take me safely through the Amazon jungle? I'd love to explore the Amazon but would not attempt it without a guide, at least not the first time. And I'd prefer a guide that wasn't going to ambush me or anything :P"
   },
   {
   "Id" : 5,
   "PostHistoryTypeId" : 1,
   "PostId" : 2,
   "RevisionGUID" : "58500a29-b9ed-4802-9934-c173ce362758",
   "CreationDate" : "2011-06-21 20:22:33",
   "UserId" : 13,
   "Text" : "How can I find a guide that will take me safely through the Amazon jungle?"
   }
  ]
  </code></pre>
  
  <p>What am I missing? Is it the right command? Thanks!</p>
  
  <p><strong>UPDATE 1</strong>:<br/>
  As CodeBird suggested I've tried this command:</p>
  
  <pre><code>mongoimport --db posts --collection rows --type json --file post_history.json --jsonArray
  </code></pre>
  
  <p>it returns this:</p>
  
  <pre><code>connected to: localhost
  Failed: error processing document #18875: invalid character 'N' after object key:value pair
  imported 10000 documents
  </code></pre>