Skip to content

Hierarchical File Format Converter

Short description

Build a program or library that can convert between common hierarchical text-based file formats such as XML, JSON, YAML, or INI. The tool should apply a simple set of rules (heuristics) to transform one format into another while ensuring both the input and the output remain syntactically correct.

  • Hierarchical data – information stored in tree-like structures.
  • File formats – XML, JSON, YAML, INI as common text-based formats.
  • Parsing – reading structured data into a program.
  • Serialization/Deserialization – converting data between text and in-memory objects.
  • Heuristic conversion – applying practical rules to guide format transformation.

High-level technical guidelines

  • Use existing parsing libraries (e.g., json, xml.etree, PyYAML, configparser) instead of writing parsers from scratch.
  • Convert parsed data into a common internal structure (like Python dictionaries or trees).
  • Focus first on simple test files before handling edge cases.
  • Provide clear error handling when input is invalid.
  • Consider adding options for pretty-printing output for readability.

Using GPT with an expert persona

Using GPT with an expert persona can be a powerful way to simulate conversations with specialists, helping you quickly understand new concepts, explore different perspectives, and even discover useful features or requirements you might not have thought of on your own. Since this is a learning environment, you can also safely test the boundaries of what GPT knows and where it fails, without any risk to your job or reputation—making it a low-stakes, high-value tool for practicing how to ask good questions, evaluate answers critically, and deepen your understanding.

...but the responsibility for correctness and implementation is still yours!

When using the expert persona prompt, treat GPT as a helpful consultant, not an unquestionable authority. The answers can give you inspiration, explanations, or practical examples, but you should always double-check information in reliable sources and test ideas in your own code. Think of it as brainstorming with an expert partner—you get useful guidance, but the responsibility for correctness and implementation is still yours.

Sample expert persona prompt

You are a friendly but professional consultant helping early-year software engineering students design a tool to convert between hierarchical file formats. Take on the perspectives of a software engineer specializing in data serialization and parsing, a systems architect familiar with structured file formats (XML, JSON, YAML, INI), a developer focused on error handling and usability, a data engineer who cares about interoperability and clean transformations, and a novice end-user who just wants to convert files without worrying about details. Be constructive, but let the students guide the discussion. If they drift from a professional tone, gently remind them. Always explain technical terminology in simple words, and encourage students to ask questions if anything is unclear. Ask as many clarification questions as possible to make sure you and the student are fully aligned before giving detailed answers.

Roles

  • Software engineer (serialization/parsing) – designs parser integrations, a common internal tree model, and safe serializers.
  • Systems architect (structured formats) – defines conversion heuristics and constraints across XML/JSON/YAML/INI.
  • Error-handling & usability developer – specifies validation, clear messages, pretty-printing, and safe defaults.
  • Data engineer (interoperability) – ensures schema mapping, type normalization, and best-effort round-tripping.
  • Novice end-user – needs a simple “convert X → Y” interface with minimal options and reliable results.