TL;DR: AI benefits significantly from structured input rather than walls of text. Use Markdown for most cases (lightweight, readable), JSON when you need precise data types, and XML for complex multi-step processes when everything else fails. Structure improves clarity and consistency in AI collaboration.
Markup Languages You Should Be Using
Structure is what stops AI from losing its mind halfway through your prompt. It's like adding paragraphs, headings, and emphasis to text, markup languages give AI clear signals about relationships, hierarchies, and data types.
Markdown for AI: Lightweight Formatting
As a longtime Obsidian user, Markdown has become the format I write everything in for organizing thoughts and documentation. Beyond personal notes, it's everywhere now in most web-based text editors that support it natively for documentation and collaborative writing. I'll even sacrifice nice-to-have features if it means I can't use Markdown.
Markdown consistently reduces frustrating moments when AI fixates on irrelevant details or misses critical instructions. The simple hierarchy helps AI maintain focus across your entire prompt rather than burning tokens on useless responses.
Basic Structure:
# Main Heading
## Secondary Heading
### Smaller Heading
**Bold text** and *italic text*
- Bulleted list item
- Another list item
1. Numbered list item
2. Another numbered item
> Quoted or emphasized content
`Code or technical terms`
[URL](https://url.nfo)
Structured prompts are more reliable, meaning you get more consistent results. It helps the AI to understand your instructions and differentiate them from your examples. The unstructured prompt often misses key requirements or tone.
Key Strengths:
Provides clear hierarchy through headers and nested lists
Supports basic formatting and online basics like links
Easy to learn, easy to read
JSON for AI prompts: Data Precision & Clear Definitions
I picked up JSON basics early in my AWS career, but didn't seriously consider it for AI work until Claude went haywire with my increasingly complex prompts. My existing JSON experience made it a natural choice to test alongside XML for taming unpredictable AI responses.
When precision matters more than readability, JSON delivers. JSON works when Markdown isn't precise enough and XML is overkill. I need exact data types, not casual formatting.
Basic Structure:
{
"task": {
"goal": "Your main objective here",
"constraints": [
"First limitation or requirement",
"Second limitation or requirement",
"Third limitation or requirement"
],
"context": "Background information the AI needs",
"output_format": "Describe exactly what you want back"
}
}
Try explaining hex values and contrast ratios in plain text and AI will guess wrong almost every time. JSON forces it to pay attention to the details.
Key Strengths:
Enforces strict data typing (strings, numbers, booleans, arrays)
Supports deep nesting for complex data structures
Balances structure and readability
XML for AI workflows: The Sledgehammer
Last year, Claude became erratic with my increasingly complex prompts. In a last-ditch effort, I read Anthropic's documentation, which recommended XML for structured prompts. Both XML and JSON have a place in my workflow, but XML's explicit tagging system proved invaluable for complex multi-step processes.
When your prompts are complex enough that the AI starts misinterpreting what you're asking for, XML saves your sanity when everything else breaks down. Which happens far more than I'd like to admit.
Basic Structure:
<?xml version="1.0" encoding="UTF-8"?>
<root_element>
<child_element attribute="value">Content</child_element>
<another_element>
<nested_element>More content</nested_element>
</another_element>
</root_element>
Key Strengths:
Provides comprehensive structure with clear relationships
Reduces data ambiguity through explicit tags
Supports attribute-level metadata
Token Economics
Token consumption directly impacts your context window. Each markup format uses tokens differently, affecting how much information you can include in a single conversation:
Markdown: Most efficient, reduces AI confusion and tangential responses
JSON: Moderate overhead, good balance of structure and efficiency
XML: Highest cost, 30-80% more than JSON
When to Use Which Format
My estimated usage:
Start with Markdown - It handles 80% of creative AI use cases
Move to JSON - When I need precise data types or clear definitions without heavy overhead (~15% of the time)
Consider XML - For multi-step processes or when all hope is lost 😱
Each of these formats offer additional benefits for team calibration, portable data, and working with enterprise tools or in areas that require strict validation. I'll expand on these use cases in coming months.
Choosing the Right Markup Language
Markdown - Use when:
Creating content-focused workflows
Token efficiency matters
Human readability is priority
JSON - Use when:
Exact data types are required
AI misunderstands relationships
Data precision trumps readability
XML - Use when:
Complex multi-step processes fail in other formats
Other structured formats fail or cause AI confusion
Better Together
These aren't mutually exclusive tools, they're complementary parts of a complete workflow. The real power comes from knowing when to reach for each one and how they work together to keep your AI interactions focused and productive.
Demonstration of all three formats together
William Trekell : Linkedin : Bluesky : Instagram : Feel free to stop by and say hi!