1

I have a large JSON file that is an array of objects, which I would like to split into smaller valid json files. Is it possible to achieve this using jq or any other off-the-shelf tools?

The original JSON is in the following format

[ {...}, {...}, ...]

Given this input I would like to produce multiple files which are valid json

Sindhu
  • 21
  • 1
  • 4
  • See also https://stackoverflow.com/questions/48790861/split-json-array-into-separate-files-objects – peak May 15 '18 at 15:28
  • If the file is extremely large, then a streaming parser solution might be preferable. See https://stackoverflow.com/questions/49808581/using-jq-how-can-i-split-a-very-large-json-file-into-multiple-files-each-a-spec – peak May 15 '18 at 16:22
  • 2
    what helped me was `jq -c '.[0:1000]' mybig.json` – djangonaut Sep 17 '18 at 07:46

0 Answers0