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§
- Json
Parser Config - Configuration for JSON/JSONL parsing and scanning.
- Json
Scan Summary - Summary of a JSON/JSONL scan.
Enums§
- Json
Error Policy - How JSON/JSONL parsing reacts to a malformed record.
- Json
Format - 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_ dimensions - Like
analyze_json_filebut only computes the requested quality dimensions. - analyze_
json_ file_ with_ dimensions_ and_ hints - 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.
- analyze_
json_ from_ reader_ with_ hints - scan_
json_ from_ reader - Scan JSON or JSONL input and invoke
on_objectfor each object record.
Type Aliases§
- Json
Object - Borrowed JSON object callback payload.