Path: blob/main/archive/unclean_locations_data/json_mergerer.py
744 views
import json12files = ['../data/extracted_locations/extracted_lrt_stns.json',3'../data/extracted_locations/extracted_mrt_stns.json',4'../data/extracted_locations/short_manual_buildings_name_list.json',5'../data/extracted_locations/extracted_buildings_address_list.json',6'../data/extracted_locations/extracted_buildings_postcode.json',7'../data/extracted_locations/extracted_road_names_list.json',8'../data/extracted_locations/extracted_subzones.json'9]101112def merge_JsonFiles(filename):13result = list()14for f1 in filename:15with open(f1, 'r') as infile:16result.extend(json.load(infile))1718list(set(result))1920with open('../data/extracted_locations/combined_locations.json', "w", encoding="utf-8") as f:21json.dump(result, f, indent=4)222324merge_JsonFiles(files)252627