GridscriptDonate

Path Stage

The Path stage runs one or more JSONPath expressions on data stored in the pipeline context. Use it to extract nested fields, route subsets to new paths, or reshape complex JSON without writing code.

What the stage does

  • Source / output paths — Read from a context field and write results to a target path (defaults to {source}_path).
  • JSONPath queries — Enter one or more paths like $.items[*].name or $[0].data. Queries run in order.
  • Match modesAll matches returns an array of matches; First match returns a single value.
  • Fallbacks — Optional JSON fallback used when no match is found (parsed from the input string).
  • Multi-query output — If multiple JSONPaths are configured, the stage outputs an array of results (one per query). With a single query, it outputs that query's result directly.
  • Error handling — Throws when the source field is missing/undefined or when a JSONPath is empty/invalid.

Configure the Path stage

  1. Choose the Source field (context path of the JSON you want to query).
  2. Set an Output field (defaults to {source}_path) to control where results are stored.
  3. Add one or more JSONPath entries:
    • Enter the path (auto-prefixes with $ if missing).
    • Choose All matches or First match.
    • Optionally set a JSON fallback (e.g., [] or null) when no match is found.
  4. Click Run Stage to preview, or Run All to execute the pipeline. Results are written to the output path and logged.

Example: extract product names

Source field: catalog

  • JSONPath: $.products[*].name
  • Match mode: All matches
  • Output field: catalog_names

The stage writes an array of product names to context.catalog_names, ready for Filter or Visualize stages.

Tips for reliable extraction

  • Validate upstream: Use Validate to ensure the source field exists and has the expected shape.
  • Multiple queries: Add multiple JSONPaths when you need several slices at once; outputs will be an array of results in the same order.
  • Branch outputs: Write extractions to new paths so you can inspect them without altering the source dataset.