The Best Data Format for Your Prompt
The data format you pick depends on what you need. If your prompt needs to be easy for people to read, Markdown is the best. For other tasks, like storing detailed data, you might want to use JSON, CSV, or YAML. Let’s go over Markdown and other formats to see when to use each one.
Quick Comparison
Format | Best For | Key Advantages | Limitations |
---|---|---|---|
Markdown | Easy-to-read prompts | Simple to read and write; flexible | Needs special tools for structure |
JSON | Complex, detailed data | Standard for APIs; works with code | Harder for people to read |
CSV | Table-like data | Compact; great for rows and columns | No advanced features |
Plain Text | Simple and small data | Very easy to write | Can’t handle complex data |
YAML | Settings and nested data | Easy for people to read; supports comments | Easy to mess up with wrong spaces |
Markdown
Markdown is the best if your prompt needs to be clear and easy for humans to read. It’s great for mixing instructions and examples. You can even add other formats, like JSON or YAML, inside Markdown for more complex needs.
Example:
# Instruction
Summarize the text below.
## Examples
- **Input:** The cat sat on the mat.
**Output:** A cat sat.
- **Input:** The dog barked at the mailman.
**Output:** A dog barked.
### Extra Data (in JSON)
```json
{
"articles": [
{"id": 1, "title": "AI in Healthcare", "content": "AI is transforming healthcare by..."},
{"id": 2, "title": "Climate Change Impact", "content": "The effects of climate change are..."}
]
}
Why pick Markdown?
- It’s easy to read and write.
- Perfect for mixing instructions and examples.
- Lets you include other formats if needed.
JSON
JSON is great when you need to store or share complex and detailed data. It’s often used for APIs and works well with computers.
Example:
{
"instruction": "Summarize the text below.",
"data_reference": {
"articles": [
{"id": 1, "title": "AI in Healthcare", "content": "AI is transforming healthcare by..."},
{"id": 2, "title": "Climate Change Impact", "content": "The effects of climate change are..."}
]
}
}
Why pick JSON?
- Works for complex and nested data.
- Computers can read it easily.
- It’s the standard for many APIs.
CSV
CSV is the go-to for simple table-like data. It’s great for rows and columns but doesn’t handle more complex stuff.
Example:
id,title,content
1,AI in Healthcare,"AI is transforming healthcare by..."
2,Climate Change Impact,"The effects of climate change are..."
Why pick CSV?
- It’s small and easy to use.
- Perfect for data in table format.
Plain Text
Plain text is the simplest format. It’s great for small prompts but doesn’t work well for complex data.
Example:
Referenced Articles:
1. AI in Healthcare: AI is transforming healthcare by...
2. Climate Change Impact: The effects of climate change are...
Why pick Plain Text?
- Super simple to write.
- Best for small and easy prompts.
YAML
YAML is easy for humans to read and great for nested data, like settings. However, you need to be careful with spaces since it’s sensitive to indentation.
Example:
instruction: Summarize the text below.
data_reference:
articles:
- id: 1
title: "AI in Healthcare"
content: "AI is transforming healthcare by..."
- id: 2
title: "Climate Change Impact"
content: "The effects of climate change are..."
Why pick YAML?
- Very readable for humans.
- Lets you add comments (unlike JSON).
Conclusion
Markdown is the best for prompts that need to be easy for humans to read. For extra data, use JSON for complex details, CSV for tables, and YAML for settings. Each format has its strengths, so pick the one that fits your project!
In WebcrawlerAPI you can get website data in Markdown and simple text. Check out our API documentation to see how you can use these formats in your projects.