How the JSONL Line Counter Works
This tool reads your JSONL content line-by-line entirely in the browser. For each non-empty line it attempts JSON.parse(). Valid lines are counted and their keys, value types, and nesting depth are recorded. Invalid lines are tallied separately with their error messages.
Statistics Explained
- Total lines — all non-empty lines in the file.
- Valid lines — lines that parsed as valid JSON objects or values.
- Error lines — lines that failed to parse, shown with their error message.
- Unique top-level keys — distinct field names found across all valid objects.
- Avg object size — mean character length of a valid line (useful for estimating token counts).
- Max nesting depth — deepest level of nested objects or arrays found in any line.
Use Cases
The line counter is useful before fine-tuning an LLM: a quick stats pass tells you how many training examples you have, whether all required fields are present on every line, and whether any lines are unexpectedly long or malformed. It is also handy for auditing log exports from systems like Elasticsearch or BigQuery before loading them into a data warehouse.