{"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/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-json/src/json/deserialize.rs#L517-L553","documentation":"The final match arm of _deserialize(): every ArrowDataType without a JSON decoding path lands here with unimplemented!, naming the dtype in the message. Handled types cover primitives, temporals, Decimal (feature-gated), Utf8 variants, LargeList, LargeBinary and Struct - so Map, Union, FixedSizeList, dictionary-encoded and other exotic types abort with this message.","triggerScenarios":"read_json/ndjson (or direct deserialize calls) with a schema containing ArrowDataType::Map, Union, FixedSizeList, Dictionary or similar - often schemas converted from arrow-rs RecordBatches, Flight, IPC or Avro-derived models.","commonSituations":"Reusing an Arrow Flight/IPC schema for JSON ingestion; schemas auto-generated from other systems that include Map or Dictionary types.","solutions":["Rewrite unsupported fields in the provided schema to supported dtypes (Map -> List(Struct{k,v}), Dictionary -> its value type, FixedSizeList -> List)","Or read with a reduced schema containing only supported columns and cast afterwards","Watch upstream for newly supported dtypes in polars-json"],"exampleFix":"// before\nlet field = ArrowDataType::Map(key_value_field, false); // -> unimplemented!(\"...{adt:?}\")\n\n// after\nlet field = ArrowDataType::LargeList(Box::new(key_value_field.into())); // map as list of {key, value}","handlingStrategy":"validation","validationCode":"fn json_supported(dt: &ArrowDataType) -> bool {\n    use ArrowDataType::*;\n    !matches!(\n        dt,\n        Map(_, _) | Union(_, _) | FixedSizeList(_, _) | Dictionary(_, _)\n    ) // and recurse into List/Struct children\n}\nfn schema_json_ready(schema: &ArrowSchema) -> Result<(), String> {\n    for f in schema.fields() {\n        if !json_supported(f.data_type()) {\n            return Err(format!(\"field {} has dtype {:?} unsupported by polars-json\", f.name(), f.data_type()));\n        }\n    }\n    Ok(())\n}","typeGuard":"fn is_json_supported_dtype(dt: &ArrowDataType) -> bool {\n    use ArrowDataType::*;\n    !matches!(dt, Map(_, _) | Union(_, _) | FixedSizeList(_, _) | Dictionary(_, _) | NullArrow)\n}","tryCatchPattern":"The message embeds the offending {adt:?}, so catch_unwind + panic-message parsing can identify the field - but schema pre-validation gives the same answer deterministically.","preventionTips":["Run schema conversion through a whitelist before JSON ingestion","Map exotic types (Map -> List(Struct), Dictionary -> value type) at the boundary","Track polars-json release notes for newly supported dtypes"],"tags":["polars","json","arrow","schema","unsupported-type","deserialization"],"backgroundTag":"unsupported-data-type","analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}