# JSONL Validator - Invalid Lines and Clean JSONL Export (`variable_mitts/jsonl-validator-reject-export`) Actor

Validate JSON Lines and export accepted JSONL plus rejected lines. Detect malformed JSON, duplicate object keys and non-finite numbers.

- **URL**: https://apify.com/variable_mitts/jsonl-validator-reject-export.md
- **Developed by:** [Dhan sites](https://apify.com/variable_mitts) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.48 / 1,000 input work unit inspecteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## JSONL Validator - Invalid Lines and Clean JSONL Export

Validate supplied JSON Lines and export accepted values plus rejected lines with source line numbers. Detect malformed JSON, duplicate object keys and non-finite values.

### Start with this workflow

Separate accepted JSONL from rejected lines before an import.

**After the run:** Download VALID.jsonl and REJECTS. Accepted values are reserialized; original whitespace and numeric lexical formatting may change.

**What is billed:** Nonblank source lines, including rejected lines; blank lines and invalid top-level input are free. Check the Pricing tab for the applicable subscription-tier rate. Result rows and billable input units can differ. A successful execution does not guarantee full coverage.

The example uses a small supplied fixture or the publisher-owned demonstration target. Replace it with input you are authorized to process; inspect coverage, diagnostics and limits before downstream use.

### Working example

```json
{
  "jsonlText": "{\"sku\":\"A\",\"price\":12}\n{\"sku\":\"B\",}\n{\"sku\":\"C\",\"sku\":\"D\"}\n{\"ok\":true}\n",
  "maxRecords": 10
}
```

### What the results mean

Each nonblank line is one input record. Blank lines are skipped and uncharged. JSON scalars are accepted as well as objects/arrays. Duplicate object keys and non-finite or overflowing numbers are rejected. Accepted JSON is reserialized, so whitespace/escape formatting and floating-point lexical representation may change. It does not repair rejected input or guarantee lossless arbitrary-precision number handling. Line numbers refer to physical source lines.

### Outputs

The default dataset shows line_number, valid, value_type, error. REPORT contains the full result and summary.processed/summary.truncated. Available file records: REPORT, BILLING, VALID.jsonl, REJECTS. Result rows may differ from billed input units.

### Pricing

$0.6 per 1,000 inspected input work units ($0.0006 each) at the entry tier. Nonblank source lines, including rejected lines; blank lines and invalid top-level input are free. Per-record rejections are inspected work. There is no run-start or automatic dataset-row event in the configured pricing. Inspect the Pricing tab for tier discounts, and REPORT/BILLING to reconcile inspected units.

### Limits and support

Default100 work units, maximum1000; at most10000 supplied records per array; serialized input2millioncharacters. The work cap applies before processing and is reduced by the run spending limit. Truncated output describes only the inspected prefix. No source data is changed, no websites fetched and no third-party API called. Run status alone is not validation: inspect REPORT and per-record errors. Use the Issues tab for support with a run ID and a small non-sensitive example. Never post private credentials.

### Who is this for?

Developers checking JSONL files before ingestion. Supply JSON Lines text, download accepted values and inspect rejected source line numbers.

### Frequently asked questions

#### Does this repair invalid JSONL or preserve exact formatting?

No. Invalid lines are exported as rejection evidence rather than repaired. Accepted JSON values are reserialized, so whitespace, escapes and numeric formatting may change. Blank lines are skipped and uncharged.

#### How do I try it before using my full input?

Open the Input tab, review the prefilled example, and run a small batch with a spending limit. Inspect the dataset and report before increasing the batch. Examples can incur the documented inspection or analysis fee; an execution marked successful can still contain rejected records or incomplete coverage.

#### Can I use the Actor through an API or on a schedule?

Yes. Use Apify's [Actor API](https://docs.apify.com/api/v2/acts-run-sync-get-dataset-items-post) or [schedules](https://docs.apify.com/platform/schedules). Keep credentials private and use the documented input fields. The pricing and limits below apply to API runs too.

### Related tools for the next step

- [JSON Dataset Validator - Required Fields and Data Types](https://apify.com/variable_mitts/dataset-contract-field-checker)
- [RAG Dataset Cleaner - Text Deduplication and Source URLs](https://apify.com/variable_mitts/rag-dataset-cleaner-evidence)

# Actor input Schema

## `maxRecords` (type: `integer`):

One total cap on inspected input units, also bounded by the run spending limit. See the description for header/join/line counting.

## `jsonlText` (type: `string`):

Sample data is synthetic and never fetched as a URL. Replace with your own authorized input.

## Actor input object example

```json
{
  "maxRecords": 10,
  "jsonlText": "{\"sku\":\"A\",\"price\":12}\n{\"sku\":\"B\",}\n{\"sku\":\"C\",\"sku\":\"D\"}\n{\"ok\":true}\n"
}
```

# Actor output Schema

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

No description

## `results` (type: `string`):

No description

## `accepted` (type: `string`):

No description

## `rejects` (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 = {
    "maxRecords": 10,
    "jsonlText": `{"sku":"A","price":12}
{"sku":"B",}
{"sku":"C","sku":"D"}
{"ok":true}`
};

// Run the Actor and wait for it to finish
const run = await client.actor("variable_mitts/jsonl-validator-reject-export").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 = {
    "maxRecords": 10,
    "jsonlText": """{\"sku\":\"A\",\"price\":12}
{\"sku\":\"B\",}
{\"sku\":\"C\",\"sku\":\"D\"}
{\"ok\":true}
""",
}

# Run the Actor and wait for it to finish
run = client.actor("variable_mitts/jsonl-validator-reject-export").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 '{
  "maxRecords": 10,
  "jsonlText": "{\\"sku\\":\\"A\\",\\"price\\":12}\\n{\\"sku\\":\\"B\\",}\\n{\\"sku\\":\\"C\\",\\"sku\\":\\"D\\"}\\n{\\"ok\\":true}\\n"
}' |
apify call variable_mitts/jsonl-validator-reject-export --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,variable_mitts/jsonl-validator-reject-export"
        }
    }
}
```

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/fxYb3PdSHzCZgKEkT/builds/3MxbB31axumYpY5BZ/openapi.json
