Skip to main content

Crate dataprof_json

Crate dataprof_json 

Source
Expand description

JSON and JSONL scanning and profiling for dataprof.

This crate is an implementation detail of the dataprof facade, which re-exports JsonParserConfig, analyze_json_from_reader, and analyze_json_file. Depend on dataprof unless you need JSON support without the rest of the workspace.

Two entry shapes are offered. scan_json_from_reader hands each record to a callback and reports what it read; analyze_json_from_reader and analyze_json_file build column profiles and a full report on top of it.

use std::io::Cursor;

use dataprof_json::{JsonParserConfig, analyze_json_from_reader};

let jsonl = "{\"id\": 1, \"city\": \"Rome\"}\n{\"id\": 2, \"city\": \"Milan\"}\n";
let (profiles, _stats, rows_read, malformed_lines, _format) =
    analyze_json_from_reader(Cursor::new(jsonl), &JsonParserConfig::jsonl())?;

assert_eq!(rows_read, 2);
assert_eq!(malformed_lines, 0);
assert_eq!(profiles[0].name, "id");

Structs§

JsonParserConfig
Configuration for JSON/JSONL parsing and scanning.
JsonScanSummary
Summary of a JSON/JSONL scan.

Enums§

JsonErrorPolicy
How JSON/JSONL parsing reacts to a malformed record.
JsonFormat
Which grammar a JSON source is read with.

Functions§

analyze_json_file
Analyze a JSON or JSONL file, returning a full ProfileReport.
analyze_json_file_with_options
Analyze a JSON or JSONL file, honouring the caller’s full analysis selection.
analyze_json_from_reader
Analyze JSON/JSONL data from a buffered reader using streaming statistics.
scan_json_from_reader
Scan JSON or JSONL input and invoke on_object for each object record.

Type Aliases§

JsonObject
Borrowed JSON object callback payload.