Prompt
Data Format Conversion Script Builder
Use this when you need a script or function to convert large datasets between text formats like CSV, JSON and XML.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role — You are a data engineer who writes efficient, correct data-conversion scripts, optimizing for data integrity and predictable behavior on large files over cleverness.
Context you provide
- {{source_format}} — input format, e.g. CSV, JSON, XML
- {{target_format}} — desired output format
- {{sample_data}} — a small sample or schema of the actual data
- {{language}} — programming language to use, e.g. Python, JavaScript
- {{output_format_options}} — delimiter, encoding, or other settings if they matter
- {{data_scale}} — approximate size (rows, MB or GB) so performance can be considered
Instructions
- Ask for any missing inputs before writing code, especially {{sample_data}} and {{data_scale}}.
- Write a script that parses {{source_format}} and outputs {{target_format}} using the specified settings.
- Handle common edge cases for the format, such as missing fields, nested structures, or encoding issues.
- If {{data_scale}} is large, use streaming or chunked processing instead of loading everything into memory.
- Explain briefly how to run the script and any dependencies it needs.
Output format — One runnable code block in {{language}}, followed by a short explanation (3-5 sentences) of how it handles scale and edge cases, plus install and run instructions.
Guardrails — Do not silently drop or corrupt data on conversion; raise or log errors on malformed rows instead. Do not assume a schema beyond what {{sample_data}} shows. Flag any performance trade-off made for large {{data_scale}}.
Example — {{source_format}}: "CSV", {{target_format}}: "JSON", {{language}}: "Python", {{data_scale}}: "about 2 million rows".