{"record":{"id":"6e61c1225f79a10e","repo":"pola-rs/polars","slug":"deserialization-from-json-not-implemented-for-adt","errorCode":null,"errorMessage":"Deserialization from JSON not implemented for {adt:?}","messagePattern":"Deserialization from JSON not implemented for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-json/src/json/deserialize.rs","lineNumber":535,"sourceCode":"        ArrowDataType::Decimal(_, _) => Ok(Box::new(deserialize_decimal(rows, dtype)?)),\n        ArrowDataType::LargeUtf8 => {\n            fill_generic_array_from::<_, _, Utf8Array<i64>>(deserialize_utf8_into, rows)\n        },\n        ArrowDataType::Utf8View => {\n            fill_generic_array_from::<_, _, Utf8ViewArray>(deserialize_utf8view_into, rows)\n        },\n        ArrowDataType::LargeList(_) => Ok(Box::new(deserialize_list(\n            rows,\n            dtype,\n            allow_extra_fields_in_struct,\n        )?)),\n        ArrowDataType::LargeBinary => Ok(Box::new(deserialize_binary(rows)?)),\n        ArrowDataType::Struct(_) => Ok(Box::new(deserialize_struct(\n            rows,\n            dtype,\n            allow_extra_fields_in_struct,\n        )?)),\n        adt => unimplemented!(\"Deserialization from JSON not implemented for {adt:?}\"),\n    }\n}\n\npub fn deserialize(\n    json: &BorrowedValue,\n    dtype: ArrowDataType,\n    allow_extra_fields_in_struct: bool,\n) -> PolarsResult<Box<dyn Array>> {\n    match json {\n        BorrowedValue::Array(rows) => match dtype {\n            ArrowDataType::LargeList(inner) => {\n                _deserialize(rows, inner.dtype, allow_extra_fields_in_struct)\n            },\n            _ => todo!(\"read an Array from a non-Array data type\"),\n        },\n        _ => _deserialize(&[json], dtype, allow_extra_fields_in_struct),\n    }\n}","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-json/src/json/deserialize.rs#L517-L553","documentation":"Catch-all arm of the polars-json deserializer: schema-driven JSON parsing only supports booleans, numerics (incl. Int128/UInt128/Float16), decimals, timestamps, dates, times, durations, LargeUtf8/Utf8View strings, LargeBinary, LargeList, and Struct. Any other ArrowDataType - legacy Utf8, plain Binary, Map, FixedSizeList, Dictionary, Extension - panics as unimplemented.","triggerScenarios":"pl.read_json / pl.read_ndjson / scan_ndjson with a schema containing an unsupported dtype, e.g. schema={\"k\": pl.Binary} (non-large Binary), Map, FixedSizeList, or legacy Utf8 obtained from Arrow schema conversion.","commonSituations":"Schemas round-tripped from Arrow IPC/Parquet (which allow Dictionary, Map, FixedSizeList, Utf8) and applied directly to JSON readers; version drift where a previously-tolerated dtype now reaches this fallback.","solutions":["Replace unsupported dtypes in the schema: String for Utf8, String for Dictionary keys, List for FixedSizeList/Map (or Struct for maps)","Let polars infer the schema first, then cast the offending column after reading","Upgrade polars - JSON dtype coverage expands over releases"],"exampleFix":"# before\npl.read_ndjson(\"x.ndjson\", schema={\"blob\": pl.Binary, \"kv\": pl.Map})  # panics\n\n# after\npl.read_ndjson(\"x.ndjson\", schema={\"blob\": pl.String, \"kv\": pl.Struct})","handlingStrategy":"validation","validationCode":"JSON_SAFE = (\n    set(pl.INTEGER_DTYPES) | set(pl.FLOAT_DTYPES)\n    | {pl.Boolean, pl.String, pl.Utf8, pl.Binary, pl.Null}\n    | {pl.Date, pl.Time, pl.Duration}\n)\ndef json_schema_ok(schema: dict) -> bool:\n    def ok(dt):\n        if dt in JSON_SAFE or isinstance(dt, (pl.Datetime, pl.Struct, pl.List, pl.Decimal)):\n            return not isinstance(dt, pl.List) or ok(dt.inner)\n        if isinstance(dt, pl.Struct):\n            return all(ok(f.dtype) for f in dt.fields)\n        return False\n    return all(ok(dt) for dt in schema.values())","typeGuard":"def unsupported_json_dtypes(schema: dict) -> list[str]:\n    bad = []\n    for name, dt in schema.items():\n        if isinstance(dt, (pl.Map, pl.Array)) or dt in (pl.Utf8, pl.Binary):\n            bad.append(name)\n    return bad","tryCatchPattern":null,"preventionTips":["Translate Arrow schemas to JSON-compatible dtypes (String for Utf8/Dictionary, List for Array/Map)","Prefer schema inference for JSON, then cast after load"],"tags":["rust","polars","panic","unimplemented","json","ndjson","schema","dtype"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}