Skip to main content
The HTML Parse command (Command ID: 1024, type PARSE) converts an HTML string on the step pipeline data field into a JSON tree shaped like { tag, attributes, children }. Use it after HTTP or browser steps that produce HTML, then chain JSONata (1022) to extract the fields you need.

Overview

The HTML Parse command provides functionality for:
  • Turning raw HTML strings into a stable JSON DOM representation
  • Preserving element tags, attributes, and nested structure
  • Representing text nodes as { tag: "#text", text: "..." }
  • Handling single-root HTML, multiple roots, and mixed text + elements

Command Type

Command ID: 1024
Command type: PARSE

Parameters

This command has no configurable parameters. The previous step must leave data as a string containing HTML (for example an HTTP response body or browser outerHTML).

Input and output

Input: data must be a string. If data is already an object or array, the command fails. Output: data is replaced by the DOM tree (unless a downstream command uses a different output key). Root shaping: Example tree (simplified):

Usage Examples

Parse HTML from the previous step

Add HTML Parse (1024) with empty params after a step that sets data to an HTML string:

Chain with JSONata to extract a value

After HTML Parse, add JSONata (1022). Expressions use data as the tree root:

Collect all text nodes

Common Use Cases

  • Sportsbook / market HTML: Parse list markup from a fetch or browser step, then JSONata into a flat list of odds or selections
  • Legacy HTML pages: Avoid fragile regex on raw HTML; query the tree with JSONata
  • Browser scraping: Parse outerHTML or a fragment returned from Run Custom Code
  • XML Parse - Parse XML strings into JSON (command ID 1019)
  • JSONata - Shape or extract fields from the DOM tree (command ID 1022)
  • Json Path - JSONPath on JSON produced by earlier parse steps