# json-price-drop

Watch a product JSON document and emit when its price is under a ceiling. DummyJSON is a public demo API.

Category: Price and market. Allow `dummyjson.com`.

Updated 2026-10-17. HTML: https://asipipes.com/pipes-library/json-price-drop

## CLI

```
pipes run examples/json-price-drop.pipe.yaml
```

## MCP call

```json
{
  "name": "pipe__json-price-drop",
  "arguments": {}
}
```

## Pipe file

`examples/json-price-drop.pipe.yaml`

```yaml
pipes: 0
name: json-price-drop
version: 0.1.0
description: Watch a product JSON document and emit when its price is under a ceiling. DummyJSON is a public demo API.
permissions:
  network: [dummyjson.com]
inputs:
  type: object
  properties:
    product_id:
      type: integer
      minimum: 1
      maximum: 100
      default: 1
    below:
      type: number
      exclusiveMinimum: 0
      default: 10000
  required: [product_id, below]
outputs:
  type: object
  properties:
    text: { type: string }
    count: { type: integer }
  required: [text, count]
output:
  text: "${steps.format.text}"
  count: "${steps.format.count}"
steps:
  - id: fetch
    block: fetch_http
    with:
      url: "https://dummyjson.com/products/${inputs.product_id}"
      max_bytes: 200000
    retry: { max: 2, backoff_ms: 500 }
    timeout_ms: 15000
  - id: parsed
    block: parse_json
    in: "${steps.fetch}"
  - id: shaped
    block: map
    in: "${steps.parsed}"
    with:
      number: [price, id]
      pick: [id, title, price]
  - id: cheap
    block: filter
    in: "${steps.shaped}"
    with:
      where: { field: price, op: lt, value: "${inputs.below}" }
  - id: changed
    block: diff_since_last
    in: "${steps.cheap}"
    with:
      key: [id]
      compare: [price]
      emit: [added, changed]
      first_run: all
  - id: format
    block: format
    in: "${steps.changed}"
    with:
      header: "Price watch:\n"
      item_template: "- ${item.title} ${item.price}"
      separator: "\n"
  - id: print
    block: emit_stdout
    in: "${steps.format.text}"
    with: { format: text }
```
