YetAnotherAPI Documentation
Signup for APIGo to main websiteContact Support
  • API Documentation
    • YetAnotherAPI Overview
    • Authentication
  • Integrations
    • Pabbly-Connect
  • Document parser
    • PDF Parser
    • Doc Parser
    • PNG & JPG Parser
    • TXT Parser
    • Parser Processing Status
  • Web Scrapper [deprecated]
    • Basic Web Scraper
    • LLM Web Scraper
    • Scrapper Processing Status
  • Web Scraper
    • Basic Web Scraper
    • Webpage links Scrapper
    • Metadata Scrapper
    • Webhook Notification
    • Status Check
  • LLM Web Scraper
    • Basic Text
    • Structured JSON
    • Best Practices
    • Use Cases
    • Status Check
  • UChat Webhook System
Powered by GitBook
On this page
  • Key Principles for Structured Prompts
  • E-commerce Examples
  • Article Examples
  • FAQ Page Structured Extraction

Was this helpful?

  1. LLM Web Scraper

Structured JSON

This guide demonstrates how to create prompts that return precisely structured JSON responses from the LLM Web Scraper API. These prompts are ideal when you need consistent, predictable data structures for integration with other systems.

Key Principles for Structured Prompts

  1. Explicitly Define Keys

    • Specify exact key names

    • Define expected data types

    • Indicate required vs optional fields

  2. Specify Nesting Structure

    • Define object hierarchies

    • Specify array structures

    • Indicate relationships between objects

  3. Include Validation Rules

    • Specify allowed values

    • Define number ranges

    • Indicate format requirements

E-commerce Examples

Product Details Extraction

{
    "url": "https://example.com/product",
    "prompt": "Extract product information using these exact keys and types: 'productName' (string), 'manufacturer' (string), 'price' (object with keys: 'current' (number), 'original' (number), 'currency' (string)), 'availability' (string: either 'In Stock', 'Out of Stock', or 'Pre-order'), 'specifications' (array of objects with keys: 'name' (string), 'value' (string)), 'features' (array of strings), 'shipping' (object with keys: 'free' (boolean), 'methods' (array of objects with keys: 'name' (string), 'price' (number), 'duration' (string)))"
}

Example Response:

{
    "productName": "Professional DSLR Camera X100",
    "manufacturer": "PhotoTech",
    "price": {
        "current": 1299.99,
        "original": 1499.99,
        "currency": "USD"
    },
    "availability": "In Stock",
    "specifications": [
        {
            "name": "Sensor Type",
            "value": "Full Frame CMOS"
        },
        {
            "name": "Resolution",
            "value": "24.2 MP"
        },
        {
            "name": "Shutter Speed",
            "value": "1/8000 to 30 sec"
        }
    ],
    "features": [
        "4K video recording",
        "Built-in WiFi",
        "Weather-sealed body",
        "Dual card slots"
    ],
    "shipping": {
        "free": true,
        "methods": [
            {
                "name": "Standard",
                "price": 0,
                "duration": "3-5 business days"
            },
            {
                "name": "Express",
                "price": 29.99,
                "duration": "1-2 business days"
            }
        ]
    }
}

Multiple Product Comparison

{
    "url": "https://example.com/category",
    "prompt": "Extract information for all products on the page using this structure: 'products' (array of objects), each product must have: 'id' (string), 'name' (string), 'brand' (string), 'category' (string), 'price' (number), 'rating' (object with keys: 'score' (number 0-5), 'count' (number)), 'specs' (object with keys matching exactly what's found in the product specs table), 'comparisonPoints' (array of objects with keys: 'feature' (string), 'value' (string), 'relativeMerit' (string: 'better', 'worse', or 'same'))"
}

Example Response:

{
    "products": [
        {
            "id": "CAM-X100",
            "name": "DSLR X100",
            "brand": "PhotoTech",
            "category": "Professional Cameras",
            "price": 1299.99,
            "rating": {
                "score": 4.8,
                "count": 245
            },
            "specs": {
                "sensorType": "Full Frame",
                "resolution": "24.2MP",
                "weight": "780g"
            },
            "comparisonPoints": [
                {
                    "feature": "Image Quality",
                    "value": "Exceptional",
                    "relativeMerit": "better"
                },
                {
                    "feature": "Battery Life",
                    "value": "1200 shots",
                    "relativeMerit": "same"
                }
            ]
        }
    ]
}

Article Examples

Structured Article Analysis

{
    "url": "https://example.com/article",
    "prompt": "Analyze the article using this exact structure: 'metadata' (object with keys: 'title' (string), 'author' (string), 'publishDate' (string in YYYY-MM-DD format), 'category' (string), 'readingTime' (number in minutes)), 'content' (object with keys: 'summary' (string), 'mainPoints' (array of strings), 'conclusions' (array of strings)), 'analysis' (object with keys: 'tone' (string: 'positive', 'negative', 'neutral'), 'audience' (string), 'expertise_level' (string: 'beginner', 'intermediate', 'advanced')), 'references' (array of objects with keys: 'text' (string), 'source' (string))"
}

Example Response:

{
    "metadata": {
        "title": "The Future of AI in Healthcare",
        "author": "Dr. Sarah Johnson",
        "publishDate": "2024-01-15",
        "category": "Technology",
        "readingTime": 12
    },
    "content": {
        "summary": "Comprehensive analysis of AI's growing role in healthcare delivery and diagnosis",
        "mainPoints": [
            "AI improving diagnostic accuracy by 40%",
            "Reduction in administrative workload",
            "Enhanced patient monitoring capabilities",
            "Cost savings through automation"
        ],
        "conclusions": [
            "AI will be integral to future healthcare",
            "Human oversight remains crucial",
            "Cost barriers decreasing rapidly"
        ]
    },
    "analysis": {
        "tone": "positive",
        "audience": "Healthcare professionals",
        "expertise_level": "intermediate"
    },
    "references": [
        {
            "text": "WHO AI in Healthcare Report 2023",
            "source": "World Health Organization"
        },
        {
            "text": "AI Diagnostic Accuracy Study",
            "source": "Medical AI Journal"
        }
    ]
}

FAQ Page Structured Extraction

{
    "url": "https://example.com/faq",
    "prompt": "Extract FAQ content using this structure: 'categories' (array of objects with keys: 'name' (string), 'description' (string), 'questions' (array of objects with keys: 'question' (string), 'answer' (string), 'tags' (array of strings), 'related_questions' (array of numbers referencing question indices))). Each answer should be concise and formatted as a single paragraph."
}

Example Response:

PreviousBasic TextNextBest Practices

Last updated 5 months ago

Was this helpful?