A Python script to stream-process large MongoDB JSON exports, replacing "af:"
and "af_"
prefixes with "true:"
and "true_"
.
β
Handles large JSON files using streaming (low memory usage).
β
Efficient field renaming (af:
β true:
).
β
Fast processing using ujson
and ijson
.
β
Batch writing to optimize disk I/O.
β
Automated unit tests with real files.
pip install -r requirements.txt
python src/json_processor.py tests/data/test_input.ndjson tests/output/test_output.ndjson --policy-parent POLICY_PARENT_ID --policy-ancestors anc1,anc2 --billing-parent BILLING_PARENT_ID --billing-ancestors anc3,anc4 --payments-parent PAYMENTS_PARENT_ID --payments-ancestors anc5,anc6
python src/json_processor.py tests/data/test_input.ndjson tests/output/test_output.ndjson \
--policy-parent POLICY_PARENT_ID --policy-ancestors anc1,anc2 \
--billing-parent BILLING_PARENT_ID --billing-ancestors anc3,anc4 \
--payments-parent PAYMENTS_PARENT_ID --payments-ancestors anc5,anc6
python -m unittest discover tests