Skip to content

JSON Array

Type Registry

JSON Array

container.object.json_array

JSON array format: [val1, val2, val3, ...]. May contain objects, scalars, or nested arrays. RECURSIVE INFERENCE: When classified as container.object.json_array, FineType will: 1. Parse the array 2. Sample elements to infer a common element type 3. Return an array of that inferred type Example: Input: [1, 2, 3, 4, 5] Output: LIST<BIGINT> Input: [{"id": 1}, {"id": 2}] Output: LIST<STRUCT<id BIGINT>>

Domain containerobject
Casts to JSON
Scope Universal

Try it

CLI
$ finetype infer -i "[1, 2, 3]"
→ container.object.json_array

DuckDB

Detect
SELECT finetype('[1, 2, 3]');
-- → 'container.object.json_array'
Cast expression
PARSE_JSON({col})
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS JSON) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'container.object.json_array';

Decompose

RECURSIVE_INFER_ON_ARRAY_ELEMENTS({col})

JSON Schema

finetype schema container.object.json_array
{
  "$id": "https://noon.sh/schemas/container.object.json_array",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "JSON array format: [val1, val2, val3, ...]. May contain objects, scalars, or nested arrays.\nRECURSIVE INFERENCE: When classified as container.object.json_array, FineType will: 1. Parse the array 2. Sample elements to infer a common element type 3. Return an array of that inferred type\nExample:\n  Input:  [1, 2, 3, 4, 5]\n  Output: LIST<BIGINT>\n\n  Input:  [{\"id\": 1}, {\"id\": 2}]\n  Output: LIST<STRUCT<id BIGINT>>",
  "examples": [
    "[1, 2, 3]",
    "[\"a\", \"b\", \"c\"]",
    "[{\"id\": 1, \"name\": \"Alice\"}, {\"id\": 2, \"name\": \"Bob\"}]"
  ],
  "pattern": "^\\[.*\\]$",
  "title": "JSON Array",
  "type": "string"
}

Examples

[1, 2, 3]["a", "b", "c"][{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]

Also known as

json_listarray

Types in container