This repository contains a script for processing and converting downloaded ChatGPT outputs. The goal is to enable efficient and streamlined conversion of ChatGPT outputs from JSON to individual Markdown files.
- Export
conversations.jsoncontaining ChatGPT history - Convert the JSON file into individual Markdown files using
json2md.py
json2md.py processes JSON files containing conversation data, validating and converting each conversation into a Markdown formatted document.
python3 json2md.py <json_filename> [-o <output_file>]<json_filename>: The JSON file containing the conversation data.<output_file>: (Optional) The directory where Markdown files will be saved; defaults to the current directory with summarized titles given by ChatGPT, and also supports Japanese summarized titles.
merge_json.py merges two JSON files into one, ensuring that there are no duplicates and that the contents are sorted by timestamp in reverse order. This is useful for consolidating conversation logs or similar data.
python3 merge_json.py <file1> <file2> [-o <output_file>]<file1>and<file2>: The JSON files to be merged.<output_file>: (Optional) The name of the output file to store the merged JSON; defaults tomerged.json.
Before using json2md.py, you may need to download your ChatGPT conversation history. Follow these steps to download your data from OpenAI:
- Sign in: Access ChatGPT at https://chat.openai.com and sign in.
- Navigate to Settings: Click on the settings option at the bottom left of the page.
- Data Controls: Select 'Data Controls' and then click on 'Export Data'.
- Confirm Export: Click 'Export', and then in the confirmation modal, click 'Confirm Export'.
- Download Data: You will receive an email with a link to download your data. This link expires after 24 hours.
- File Format: The download will be a .zip file containing your conversation history in
conversations.jsonand other data.
For more detailed instructions and screenshots, please refer to the official guide on How to Export ChatGPT History and Data.
In developing this script, I referred to Bastian Moritz's web article, which can be found at How-to Convert Your Exported ChatGPT Conversations to use with Obsidian.