I am new to JSON, never used python packages to manipulate JSON files. I have 10 JSON files that I would like to merge into one using python.
Each of 10 files has the exact same structure and has about 50,000 entries
Example:
File one
{"tracking_code":"21703238","from_country":"FR","to_country":"FR","amount":3.23}
...
Example: File two
{"tracking_code":"41545695","from_country":"FR","to_country":"FR","amount":2.9}
...
Desired output would simply be:
{"tracking_code":"21703238","from_country":"FR","to_country":"FR","amount":3.23}
{"tracking_code":"41545695","from_country":"FR","to_country":"FR","amount":2.9}
The second part of my questions would be this - how would I join JSON files based on one key? I would like to join these 2 files by "tracking_code", the output file would simply add '"amount":3.23' to the first file.
Example: File one:
{"tracking_code":"29285908","from_country":"FR","to_country":"FR",
"package_type_id":10,"transaction_id":172238850,
"shipping_label_created":"2018-09-25 18:40:52"}
Example: File two
{"tracking_code":"29285908","from_country":"FR","to_country":"FR","amount":3.23}
Desired output:
{"tracking_code":"29285908","from_country":"FR","to_country":"FR",
"package_type_id":10,"transaction_id":172238850,
"shipping_label_created":"2018-09-25 18:40:52","amount":3.23}
Thank you.