HARPA.AI
LIBRARYUSE CASESGUIDESAI COMMANDSBLOG

📦  Convert Page to JSON

Extract webpage data into structured and customizable JSON format. Results can be downloaded, sent via webhook, or used in other commands.

Created by HARPA AI
Updated on Dec 12, 11:12
Installed 116 times
SENDS HTTP REQUESTS

How to Use

IMPORT COMMAND

Content

- param: fields
  message: |-
    Describe the fields that should be in the JSON and their content, e.g.:

    ```
    url - webpage URL,
    title - product title, 
    description - a brief description of the product’s features.
    ```

    Or send an example of the JSON file you would like to receive, e.g.:

    ```
    {
      "product": "Product name",
      "description": "Brief product description",
      "price": 1000,
      "url": "page url"
    }
    ```
  vision:
    enabled: false
    mode: area
    send: true
    hint: ''
  type: ask
  options: null
  default: ''
- prompt: >-
    You are a Data Research AI Agent.

    Your task is to extract data from a web page and respond with JSON as
    requested.


    Follow these instructions:

    - Analyze the web page and all the information needed to fill the requested
    JSON fields:

    {{fields}}


    - If I haven't described criteria for determining the information for
    corresponding fields, decide this independently based on your judgment.

    - Respond in {{language}}.

    - Be concise and to the point.

    - Respond with a JSON array containing object (or objects) with fields.

    - Write nothing other than the JSON.

    - Wrap your JSON response in a code block.


    Example JSON response:

    {
        "field1": "Text",
        "field2": "Text",
        "field3": "Text",
        "field4": "Text"
    }


    Webpage URL: {{url}}


    Webpage Data: {{page}}



    JSON response:
  type: gpt
  param: json
- type: calc
  func: extract-json
  to: json
  param: json
  index: ''
- to: g.json
  func: clone
  type: calc
  from: json
- message: JSON is stored in **{{g.json}}** and can be used in other commands.
  type: say
  interpolate: false
- param: action
  options:
    - value: done
      label: ✅ DONE
    - label: 📦 EXPORT
      value: export
    - label: 🔗 SEND VIA WEBHOOK
      value: webhook
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  type: ask
  message: ''
  default: ''
  optionsInvalid: false
- condition: '{{action}} = done'
  type: stop
- what: param
  condition: '{{action}} = export'
  type: export
  param: json
- steps:
    - param: webhook
      message: 'Please provide the Webhook URL:'
      vision:
        enabled: false
        mode: area
        hint: ''
        send: true
      type: ask
      options: null
      default: ''
    - type: request
      url: '{{webhook}}'
      method: auto
      body: '{{json}}'
      auth:
        enabled: false
        username: ''
        password: ''
      headers: null
      param: ''
      bodyInvalid: true
  condition: '{{action}} = webhook'
  type: group
Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service
CAN WE STORE COOKIES?
Our website uses cookies for the purposes of accessibility and security. They also allow us to gather statistics in order to improve the website for you. More info: Privacy Policy