import json import re nikkei_scraps = [] with open('nikkei_scrap.json') as json_data: page_data = json.load(json_data) nikkei_scraps = [page['title'] for page in page_data['relatedPages']['links1hop']] with open('takker-memex.json') as json_data: page_data = json.load(json_data) newspaper_data = {'pages': [page for page in page_data['pages'] if (page['title'] in nikkei_scraps) and re.search('日本経済新聞|NIKKEI|日経', page['title'])]} print(f'Got {len(newspaper_data["pages"])} pages') with open('output.json', 'w') as output: json.dump(newspaper_data, output, indent=4, ensure_ascii=False)