# From JSON Strings to Typed Columns

DevFeed: [From JSON Strings to Typed Columns](<https://devfeed.tech/articles/from-json-strings-to-typed-columns-88444.md>)

Original publisher: [Read original article](<https://duckdb.org/2026/10/16/json-to-typed-columns.html>)

Author: The DuckDB team

Published: 2026-10-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [DuckDB](<https://devfeed.tech/sources/duckdb.md>)

Topics: [JSON](<https://devfeed.tech/topics/json.md>), [payload](<https://devfeed.tech/topics/payload.md>), [etl](<https://devfeed.tech/topics/etl.md>), [Data pipelines](<https://devfeed.tech/topics/data-pipelines.md>)

Tags: [cast](<https://devfeed.tech/tags/cast.md>), [column](<https://devfeed.tech/tags/column.md>), [data-type](<https://devfeed.tech/tags/data-type.md>), [duckdb](<https://devfeed.tech/tags/duckdb.md>), [events](<https://devfeed.tech/tags/events.md>), [example](<https://devfeed.tech/tags/example.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [json](<https://devfeed.tech/tags/json.md>), [schema](<https://devfeed.tech/tags/schema.md>), [strings](<https://devfeed.tech/tags/strings.md>), [table](<https://devfeed.tech/tags/table.md>), [text](<https://devfeed.tech/tags/text.md>), [using-duckdb](<https://devfeed.tech/tags/using-duckdb.md>)

## AI overview

DuckDB can convert JSON stored in a VARCHAR column directly into typed columns in SQL, without writing it to a file. Cast the values to JSON and use json_group_structure to infer a schema across rows; sampling reduces the scan cost but may miss rare keys. Adjust inferred types, such as converting timestamp strings and narrowing integers, with json_merge_patch, then use json_transform and unnest to create regular columns. Missing keys become NULL. Recursive unnesting can flatten nested structs, with keep_parent_names preventing duplicate names; unnesting an array produces one row per item, while a LEFT JOIN preserves rows with no items. json_transform turns unconvertible values into NULL by default; json_transform_strict raises errors and is useful while validating the structure. Parsing once into typed columns avoids repeating JSON parsing on later queries. The article says DuckDB's JSON type has the same storage size and scan speed as VARCHAR, while adding input validation.

## Source excerpt

JSON often arrives as a text column inside a table, not as a file. In this post, we infer a schema from such a column, adjust it, and turn the column into typed columns, without first writing the data to a file.