# JSON Drift Brief (`witforsurprise/json-drift-brief`) Actor

Compare two JSON samples for nested fields, type changes, missing data and empty values. Get a readable HTML report plus JSON output. No scraper runs or external credentials. Array contents are not inspected.

- **URL**: https://apify.com/witforsurprise/json-drift-brief.md
- **Developed by:** [Daniel](https://apify.com/witforsurprise) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$30.00 / 1,000 comparison reports

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## JSON Drift Brief

Compare two JSON samples before a downstream workflow consumes changed data. See nested fields that appeared or disappeared, changes in value types, and shifts in missing, null, blank or empty-container rates. Download a readable HTML brief and a JSON report.

### Try the sample

Keep the prefilled Before and After samples, then run. Open **Readable HTML report** or **Full JSON report**. The example reports four signals: `rating` removed, `price` changed from number to string, `promo` added, and blank titles rising from 0% to 40%.

Paste your own JSON arrays of objects to compare data. URLs and file paths are not fetched. No scraper credentials are required. This is an explicit comparison tool, not a scraper or continuous monitoring service. It does not claim to be the only drift tool or replace schema validation.

### How it works

- Object fields use JSON Pointer paths, e.g. `/details/stock`. Literal `/` and `~` in keys are escaped.
- Field additions/removals and changes in the observed type set always appear.
- Presence, null, blank string and empty-container rates are separate; rates use **all rows in the respective sample** as denominator. Default threshold: 10 percentage points.
- Zero and false are not empty. Empty samples are `inconclusive`.
- No reported signals means **no changes in inspected properties at the chosen threshold**, not proof the data is correct. Different row counts are displayed; this is not a significance test.

### Limits

Maximum 2,000,000 UTF-8 bytes and 20,000 rows per sample, 32 nesting levels below the root array, 250,000 nodes, and 5,000 distinct paths. Each field path is limited to 2,048 UTF-8 bytes, with at most 2,000,000 combined bytes of distinct paths per sample. These path limits also bound report size. Exceeding limits fails clearly.

**Array elements are not inspected.** Array fields and empty-array rates are checked; paths are disclosed. Changes inside arrays may be missed. No row identity matching, numeric distribution checks, individual value comparison or semantic validation. Small or unrepresentative samples may mislead.

Duplicate keys, malformed JSON, non-finite numbers and invalid Unicode are rejected. Source row values are not written to application logs or reports. **Field names are included and may be sensitive.**

### Data handling

This Actor runs on Apify, not in your browser. Input is sent to Apify and stored with the run; output is stored in the run's dataset and key-value store. Access and retention follow your Apify settings and policy. Do not paste secrets or data you are not authorized to process. The application sends no data to external APIs and fetches no external URLs.

### Pricing and beta status

Experimental price: **US$0.03 per completed comparison report**, including `inconclusive` reports from empty samples. This is one charge per report, not per input row, field or detected change. Check the displayed Apify pricing panel before running.

The report price includes processing. There is no separate startup charge. A completed comparison includes both the HTML and JSON reports.

Set the run budget to at least the displayed price for one report. If the remaining budget is insufficient, the run stops before creating a report. Rejected input and insufficient-budget runs do not incur the comparison-report charge. Apify's displayed terms govern any other applicable platform charges.

This is an early product with the limits described above. Please check its example and supported comparisons before using it in a production workflow.

### Development

Python 3.13+, `pip install -r requirements.txt`, `python -m unittest discover -s tests -v`. To test the Actor locally, copy `examples/INPUT.json` to `storage/key_value_stores/default/INPUT.json`, then `python -m src`, without cloud credentials.

# Actor input Schema

## `beforeJson` (type: `string`):

Paste an array of objects. Maximum 2 MB and 20,000 rows. Inputs run and are stored on Apify; do not paste secrets.

## `afterJson` (type: `string`):

Paste the second sample. Same limits apply. URLs and file paths are not fetched.

## `thresholdPercentagePoints` (type: `number`):

Minimum absolute change in presence, null, blank or empty-container rates. Field and type changes always appear.

## Actor input object example

```json
{
  "beforeJson": "[{\"id\": 0, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 1, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 2, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 3, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 4, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 5, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 6, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 7, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 8, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 9, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}]",
  "afterJson": "[{\"id\": 0, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 1, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 2, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 3, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 4, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 5, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 6, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 7, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 8, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 9, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}]",
  "thresholdPercentagePoints": 10
}
```

# Actor output Schema

## `report` (type: `string`):

No description

## `json` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "beforeJson": "[{\"id\": 0, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 1, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 2, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 3, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 4, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 5, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 6, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 7, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 8, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 9, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}]",
    "afterJson": "[{\"id\": 0, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 1, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 2, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 3, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 4, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 5, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 6, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 7, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 8, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 9, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}]"
};

// Run the Actor and wait for it to finish
const run = await client.actor("witforsurprise/json-drift-brief").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "beforeJson": "[{\"id\": 0, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 1, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 2, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 3, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 4, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 5, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 6, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 7, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 8, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 9, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}]",
    "afterJson": "[{\"id\": 0, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 1, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 2, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 3, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 4, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 5, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 6, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 7, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 8, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 9, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}]",
}

# Run the Actor and wait for it to finish
run = client.actor("witforsurprise/json-drift-brief").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "beforeJson": "[{\\"id\\": 0, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 1, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 2, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 3, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 4, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 5, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 6, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 7, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 8, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}, {\\"id\\": 9, \\"price\\": 10, \\"rating\\": 5, \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}}]",
  "afterJson": "[{\\"id\\": 0, \\"price\\": \\"10\\", \\"title\\": \\"\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 1, \\"price\\": \\"10\\", \\"title\\": \\"\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 2, \\"price\\": \\"10\\", \\"title\\": \\"\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 3, \\"price\\": \\"10\\", \\"title\\": \\"\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 4, \\"price\\": \\"10\\", \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 5, \\"price\\": \\"10\\", \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 6, \\"price\\": \\"10\\", \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 7, \\"price\\": \\"10\\", \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 8, \\"price\\": \\"10\\", \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}, {\\"id\\": 9, \\"price\\": \\"10\\", \\"title\\": \\"Product\\", \\"details\\": {\\"stock\\": 5}, \\"promo\\": true}]"
}' |
apify call witforsurprise/json-drift-brief --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,witforsurprise/json-drift-brief"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/xyc42hiYwWmdOWqNw/builds/h4RdZqhRDpEk8wwnZ/openapi.json
