Mac で実行していて、10 万を超えるオブジェクトを含む非常に大きな .json ファイルがあります。
ファイルを多くのファイル (できれば 50 ~ 100) に分割したいと考えています。
ソースファイル
元の .json ファイルは多次元配列で、次のようになります。
[{
"id": 1,
"item_a": "this1",
"item_b": "that1"
}, {
"id": 2,
"item_a": "this2",
"item_b": "that2"
}, {
"id": 3,
"item_a": "this3",
"item_b": "that3"
}, {
"id": 4,
"item_a": "this4",
"item_b": "that4"
}, {
"id": 5,
"item_a": "this5",
"item_b": "that5"
}]
望ましい出力
これが 3 つのファイルに分割されている場合、出力は次のようになります。
ファイル 1:
[{
"id": 1,
"item_a": "this1",
"item_b": "that1"
}, {
"id": 2,
"item_a": "this2",
"item_b": "that2"
}]
ファイル 2:
[{
"id": 3,
"item_a": "this3",
"item_b": "that3"
}, {
"id": 4,
"item_a": "this4",
"item_b": "that4"
}]
ファイル 3:
[{
"id": 5,
"item_a": "this5",
"item_b": "that5"
}]
どんなアイデアでも大歓迎です。ありがとうございました!