Search Shortcut cmd + k | ctrl + k

Parse TOML documents into JSON

Maintainer(s): vergenzt

Installing and Loading

INSTALL toml FROM community;
LOAD toml;

Example

SELECT parse_toml('
  [server]
  host = "localhost"
  port = 5432
') AS cfg;

-- the result is DuckDB's JSON type, so the JSON toolchain works directly
WITH t AS (SELECT parse_toml(content) AS cfg FROM read_text('config.toml'))
SELECT cfg->'server'->>'host', (cfg->'server'->'port')::INT FROM t;

About toml

This extension provides a single scalar function, parse_toml(VARCHAR) -> JSON, which parses a TOML document string into DuckDB's JSON logical type. TOML datetimes become RFC 3339 strings that cast cleanly to DuckDB temporal types, and the TOML int/float distinction is preserved. Read TOML from local files, https, or S3 by composing with read_text. See the repository for details.

Added Functions

function_name function_type description comment examples
parse_toml scalar NULL NULL  

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.