Skip to content
PD
Browser Automation Studio

Parsing JSON in BAS

The JSON module in Browser Automation Studio — read and modify JSON with JSONPath, the right tool for API responses and structured data the HTTP client returns.

When data comes back as JSON rather than a rendered page — from an API, an XHR call, or the HTTP client — the right tool isn’t XPath, it’s the JSON module. It reads and reshapes JSON using JSONPath, the JSON equivalent of an XPath query.

What it’s for

The JSON module works with JSON data through JSONPath expressions. Where XPath addresses elements in HTML, JSONPath addresses values in a JSON document — you write a path to the field you want and the module returns it. This is how you pull structured data out of API and HTTP-client responses cleanly.

The actions

Reading.

  • Get value — return a single value at a JSONPath.
  • Get all values — return every value matching a path.
  • Get slice — read an array or a portion of one.
  • Count elements — how many items an array holds.

Modifying.

  • Change value — set a value at a path.
  • Delete value — remove a value.
  • Change format — reformat the JSON.

Validating.

  • Is suitable for JSONPath — check whether a path resolves before relying on it.

Where it fits

JSON parsing is the natural partner of the HTTP client. A common pattern: send a request to an API, get a JSON body back, then use Get value and Get all values with JSONPath to extract the fields you need — far faster and cleaner than scraping a rendered page. Use XPath for HTML, JSON for APIs, and you’ve covered the two ways structured data reaches your bot.

FAQ

How do I parse an API response in BAS?

Use the JSON module. It reads JSON with JSONPath expressions — get a single value, get all values, read a slice or array, and count elements — which is exactly how you extract fields from an API or HTTP-client response.

What is JSONPath in BAS?

JSONPath is the query language the JSON module uses to address parts of a JSON document, similar to how XPath addresses HTML. You write a path to the value you want and the module returns it.

More on this topic

  • #Browser Automation Studio
  • #BAS
  • #JSON
  • #API
  • #Parsing

Have an idea? Let’s turn it into a working product.

Skip months of uncertainty. Get a clear architecture, a working MVP and a system you can test, sell and scale.