From b31adcf66bc8fe05e5876030fe223e863e71e6d9 Mon Sep 17 00:00:00 2001 From: cyroxx Date: Mon, 29 Dec 2025 17:56:17 +0100 Subject: [PATCH] add json_to_txt converter --- convert_json_to_txt.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 convert_json_to_txt.py diff --git a/convert_json_to_txt.py b/convert_json_to_txt.py new file mode 100644 index 0000000..c2f666e --- /dev/null +++ b/convert_json_to_txt.py @@ -0,0 +1,24 @@ +import json + + +with open("thread_posts.json") as f: + posts = json.load(f) + + +posts_txt = [] + +for post in posts: + single_txt = f"""{post['author']} schrieb um {post['timestamp']}: + +{post['text']}""" + + posts_txt.append(single_txt) + + +all_posts = """ + +########## + +""".join(posts_txt) + +print(all_posts) \ No newline at end of file