The Best Data Format for Your Prompt

6 min read to read

Learn which data format is best for your prompt. Markdown, JSON, CSV, Plain Text, and YAML each have their strengths and weaknesses.

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

FormatBest ForKey AdvantagesLimitations
MarkdownEasy-to-read promptsSimple to read and write; flexibleNeeds special tools for structure
JSONComplex, detailed dataStandard for APIs; works with codeHarder for people to read
CSVTable-like dataCompact; great for rows and columnsNo advanced features
Plain TextSimple and small dataVery easy to writeCan’t handle complex data
YAMLSettings and nested dataEasy for people to read; supports commentsEasy 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.