> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Structured Data

> Use AI to generate structured outputs that can be used in other apps and workflows.

The **Generate Structured Data** node transforms AI responses from text paragraphs into organized tables that you can use in Google Sheets, databases, or other systems.

## The Challenge with AI Text Responses

When you ask AI to analyze data, it typically responds with paragraphs of text that are hard to use:

* Difficult to import into spreadsheets
* Can't be used for calculations
* Hard to compare or sort information
* Not consistent between different queries

## The Solution: Structured Tables

This node ensures AI returns organized data in table format that you can immediately use in other tools. Instead of paragraphs, you get clean rows and columns ready for Google Sheets, your CRM, or any other system.

***

## When to Use It

Use this node when you want AI to return **tables of data** instead of text paragraphs:

* Add calculated columns to existing data
* Extract structured information from text
* Create consistent data formats for other tools
* Convert messy data into clean tables

***

## Example 1: Adding Calculated Columns

**The Challenge:** If you ask regular AI to analyze campaign data, it responds with text like "Campaign A has a cost per conversion of \$33.33..." This text can't be used in spreadsheets.

**The Solution:** Get the same analysis as an organized table ready for Google Sheets.

**Your Data:**

```
Campaign A: $1,500 cost, 45 conversions
Campaign B: $2,000 cost, 80 conversions  
Campaign C: $800 cost, 32 conversions
```

**What You Want:** Add a "Cost Per Conversion" column

**How to Set It Up:**

1. **Prompt:**

```
Take this campaign data and create a table with cost per conversion calculated for each campaign:
[Insert your campaign data here]
```

2. **Schema Type:** List of Objects (because you want multiple rows)

3. **Schema Fields:**
   * `campaign_name` (Text) - "Name of the campaign"
   * `cost` (Number) - "Total cost spent"
   * `conversions` (Number) - "Number of conversions"
   * `cost_per_conversion` (Number) - "Cost divided by conversions"

**Result:**

| Campaign Name | Cost | Conversions | Cost Per Conversion |
| ------------- | ---- | ----------- | ------------------- |
| Campaign A    | 1500 | 45          | 33.33               |
| Campaign B    | 2000 | 80          | 25.00               |
| Campaign C    | 800  | 32          | 25.00               |

This table can be sent directly to Google Sheets or used in other workflow steps.

***

## Example 2: Lead Qualification

**The Challenge:** Regular AI would analyze emails and respond with text like "John from TechCorp seems like a good lead..." This text is hard to organize and compare.

**The Solution:** Get lead analysis as structured data with consistent scoring for easy CRM import.

**Your Data:**

```
Email 1: "Hi, I'm John from TechCorp. We're a 50-person company looking for marketing automation. Budget is around $5K/month. Need to implement by Q2."

Email 2: "Hello, small business owner here. Interested in your services but need to keep costs low. Maybe $500/month max."
```

**What You Want:** Qualify leads with consistent scoring

**How to Set It Up:**

1. **Prompt:**

```
Analyze these sales inquiries and score each lead based on budget, company size, and urgency:
[Insert email inquiries here]
```

2. **Schema Type:** List of Objects

3. **Schema Fields:**
   * `company_name` (Text) - "Company name mentioned"
   * `contact_person` (Text) - "Person's name"
   * `budget_monthly` (Number) - "Monthly budget in dollars"
   * `company_size` (Text) - "Small, Medium, or Large"
   * `urgency` (Text) - "High, Medium, or Low"
   * `qualification_score` (Number) - "Score from 1-10 based on fit"

**Result:**

| Company Name | Contact Person | Budget Monthly | Company Size | Urgency | Score |
| ------------ | -------------- | -------------- | ------------ | ------- | ----- |
| TechCorp     | John           | \$5,000        | Medium       | High    | 9     |
| Unknown      | Unknown        | \$500          | Small        | Low     | 3     |

Now you have consistent lead data that can go into your CRM.

***

## Schema Types

**List of Objects:** Use when you want multiple rows (like a table)

* Campaign performance data
* Lead qualification
* Product comparisons
* Survey responses

**Single Object:** Use when you want one summary row

* Total campaign summary
* Overall lead score
* Single product analysis

***

## Inputs

| Field             | Type              | Required | Description                                                 |
| ----------------- | ----------------- | -------- | ----------------------------------------------------------- |
| **Prompt**        | Dynamic Text Area | Yes      | Instructions for AI on what data to extract and structure   |
| **Model**         | Model Selector    | Yes      | AI model (GPT-4.1 Mini is good for most cases)              |
| **Schema Type**   | Select            | Yes      | "List of Objects" for tables, "Single Object" for summaries |
| **Schema Fields** | Schema Builder    | Yes      | Define your table columns                                   |

***

## How to Define Schema Fields

For each column in your table:

**Name:** Use simple names like `campaign_name`, `total_cost`, `conversion_rate`

**Type:**

* Text: Names, descriptions, categories
* Number: Costs, counts, scores
* Percentage: Rates (returns as 0.15 for 15%)

**Description:** Tell the AI exactly what to put in this column:

* "Campaign name from the data"
* "Total cost in dollars"
* "Cost divided by conversions, rounded to 2 decimals"

***

## Frequently Asked Questions

<Accordion title="What's the difference between List of Objects and Single Object?">
  **List of Objects:** Creates a table with multiple rows (like a spreadsheet)

  * Use for: Multiple campaigns, leads, products, etc.
  * Example: Campaign performance table with 10 rows

  **Single Object:** Creates one summary row

  * Use for: Overall totals, single analysis, summary reports
  * Example: Total campaign spend across all campaigns
</Accordion>

<Accordion title="Why isn't my schema being followed correctly?">
  **Make field descriptions more specific:**

  * Instead of "Budget" → "Monthly budget in USD dollars"
  * Instead of "Score" → "Lead quality score from 1-10"
  * Include calculation instructions: "Cost divided by conversions"

  **Add examples in your prompt:**
  "If company name not mentioned, use 'Unknown'"
</Accordion>

<Accordion title="Can I use this data directly in Google Sheets?">
  Yes! The structured output is designed to work seamlessly with Google Sheets:

  * Each schema field becomes a column header
  * Each row of data becomes a spreadsheet row
  * Data types are preserved (numbers, text, percentages)
</Accordion>

<Accordion title="What if some data is missing from my input?">
  Handle missing data in your field descriptions:

  * "If budget not mentioned, use 'Not specified'"
  * "If date not provided, use 'Unknown'"
  * "If calculation can't be made, use 0"

  This ensures consistent table structure even with incomplete data.
</Accordion>

<Accordion title="Which AI model should I use?">
  **GPT-4.1 Mini (default):** Good balance of speed and accuracy for most structured data tasks

  **GPT-4.1:** Use for complex calculations or when you need higher accuracy

  **GPT-4o:** Faster processing for simple data extraction tasks

  Start with the default Mini model and upgrade only if you need better accuracy.
</Accordion>

<Accordion title="How do I test my schema before processing large datasets?">
  1. Start with 2-3 sample items in your prompt
  2. Run the node and check the output format
  3. Adjust field descriptions if needed
  4. Once satisfied, process your full dataset

  This saves time and ensures your schema works correctly.
</Accordion>
