Loading...

vastorbit.pjson

vastorbit.pjson(path: str, lines: bool = False) dict[str, str]

Parse a JSON file and return inferred column types.

Supports wildcard patterns - will analyze first matching file.

This is a simplified version that returns type information without creating tables. Useful for inspecting JSON structure.

Parameters:
  • path (str) – Path to the JSON file(s). Supports wildcards (e.g., '*.json')

  • lines (bool, optional) – If True, read JSON lines format (default: False)

Returns:

Dictionary mapping column names to Trino types

Return type:

dict

Examples

from vastorbit.core.parsers.json import pjson

# Inspect single JSON
types = pjson('data.json')
print(types)
# {'id': 'INTEGER', 'name': 'VARCHAR(50)', 'metadata': 'VARCHAR'}

# Inspect first matching JSON
types = pjson('events_*.json')

# Inspect JSON lines
types = pjson('data.jsonl', lines=True)