use tandoor json, directly from the api

This commit is contained in:
neingeist 2025-06-06 22:18:53 +02:00
parent f89a9683e0
commit b2ab88b216
80 changed files with 20922 additions and 1996 deletions

View file

@ -1,16 +1,6 @@
import json
import re
input_file = 'export_2025-06-02.json'
output_file = 'export_2025-06-02_clean.json'
with open(input_file, 'r', encoding='utf-8') as f:
data = json.load(f)
# indent input file while we're at it
with open(input_file, 'w', encoding='utf-8') as f:
json.dump(data, f, ensure_ascii=False, indent=2)
def normalize_ingredients(recipe):
if 'recipeIngredient' in recipe:
recipe['recipeIngredient'] = [
@ -52,13 +42,4 @@ def normalize_recipe(recipe):
return cleaned_recipe
if isinstance(data, list):
cleaned_data = [normalize_recipe(recipe) for recipe in data]
else:
cleaned_data = normalize_recipe(data)
# Write the cleaned JSON data to a new file
with open(output_file, 'w', encoding='utf-8') as f:
json.dump(cleaned_data, f, ensure_ascii=False, indent=2)
print(f"Cleaned data written to '{output_file}'")
# TODO