SyntaxError: Unexpected end of JSON input
2803media opened this issue · comments
Hi
I want to remove all the properties from my geojson file so for that I first try to make a njson file like that:
/root/npm/bin/ndjson-split 'd.features' < test.json > test.ndjson
but I get this error:
stdin:1
{"type":"FeatureCollection","features":[
^
SyntaxError: Unexpected end of JSON input
My geojson is a valid one, it's just here: https://gist.github.com/2803media/b52c9078c6c7932396ce6b42d7f0073e
Thanks
After digging, it seems that if the geojson had some space or line break it will failed the ndjson-split function.
The walkthrough to debug was:
-to convert the geojson to topojson
-convert topojson to geojson
-then do ndjson-split
I don't know if it's possible to integrate this point in ndjson-split
ndjson-split expects NDJSON input, not JSON. You can use ndjson-cat to convert JSON into NDJSON (i.e., to remove newlines).
ndjson-cat test.json | ndjson-split 'd.features' > test.ndjson