Now I need the opposite tool from this one: something to convert a line-delimited GeoJSON file to a single GeoJSON file.

In other words:

  1. Write { "type": "FeatureCollection", "features": [ on the first line.
  2. Append all the lines from the input file, with a comma at the end of all of them except the last.
  3. Then write ]}

Is there such a tool?

1 Answer 1


Heh, predictably, I wrote one. (Added to the existing geojson2ndjson package.)

npm install -g geojson2ndjson
ndjson2geojson myfile.json > myfile.geojson


  • Heh, someone downvoted this? Why? Feb 16, 2020 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.