Invalid character after object key - What is an object key in geojson?
Asked Answered
S

1

5

I am importing the following text file to geojson:

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{type":"LineString","coordinates":[[-122.029517,37.976152]]},"properties":{"name":"thing","origin":"somewhere","end":"blah"}}]}

mongoimport -vvv --db <db> --collection <collection-name> --file <file-name>

The long verbose output is :

<Date, etc> -0700   using 4 decoding workers
<Date, etc> -0700   using 1 insert workers
<Date, etc> -0700   filesize: 921 bytes
<Date, etc> -0700   using fields: 
<Date, etc> -0700   connected to: localhost
<Date, etc> -0700   ns: <db>.<collection>
<Date, etc> -0700   connected to node type: standalone
<Date, etc> -0700   standalone server: setting write concern w to 1
<Date, etc> -0700   using write concern: w='1', j=false, fsync=false, wtimeout=0
<Date, etc> -0700   Failed: error processing document #1: invalid character '"' after object key
<Date, etc> -0700   standalone server: setting write concern w to 1
<Date, etc> -0700   using write concern: w='1', j=false, fsync=false, wtimeout=0
<Date, etc> -0700   imported 0 documents

As you can see, the error is invalid character '"' after object key. The quotes are necessary, however. Is there an easy fix for this?

Scarrow answered 17/7, 2015 at 22:2 Comment(0)
R
8

It appears the third instance of the word type is not properly quoted. If you add a double quote prior to that word you should be able to import without any issues.

Recently answered 17/7, 2015 at 22:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.