Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,19 @@ def parse_json(content: str, record_path: Optional[str] = None, auto_explode: bo

# Legacy single-row behavior for object payloads when explosion is disabled.
if not auto_explode and isinstance(data, dict):
return _ensure_scalar_columns(pd.json_normalize(data))
return _ensure_scalar_columns(pd.json_normalize(data, sep='_'))

records, chosen_path = _resolve_records(data, record_path)
if records is None:
return pd.DataFrame({'value': [data]})
if len(records) == 0:
return pd.DataFrame()

df = pd.json_normalize(records, sep='.')
# Flatten nested dicts with an underscore separator (e.g. day_c), NOT a dot.
# MindsDB executes projections through DuckDB, where a dotted name like `day.c`
# is parsed as a struct/table qualifier (column `c` of `day`) instead of a
# column literally named "day.c" — and no quoting form survives that rewrite.
df = pd.json_normalize(records, sep='_')

# Reattach top-level scalar siblings (status, count, request_id, ...) as
# constant columns so envelope metadata is not lost. Skip the array key;
Expand Down
Loading