baml.toml.item_from_json

Converts a JSON value to a TOML item.

Reference version

Signature

function baml.toml.item_from_json(json: baml.json.json) -> baml.toml.Item throws baml.json.DecodeError

Converts a JSON value to a TOML item.

Table.from_json is usually the better entry point, since it skips nulls instead of erroring on them. This inverts item_to_json only up to the datetime loss noted there: a JSON string stays a string, never a baml.time value.

Throws

  • baml.json.DecodeError if json is null or bigint, or if either appears as an array element anywhere beneath it. Nulls in object values are skipped by the Table.from_json this recurses through.

Source:<builtin>/baml/ns_toml/toml.bamlbytes 57616231