Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(datasets-csv-upload): no longer nest column values if single valid json object (#8416)

marliessophie9fa31ba68ee3
diff --git a/web/src/features/datasets/lib/csvHelpers.ts b/web/src/features/datasets/lib/csvHelpers.ts
index c19d8d690f..8cd882e7c0 100644
--- a/web/src/features/datasets/lib/csvHelpers.ts
+++ b/web/src/features/datasets/lib/csvHelpers.ts
@@ -214,6 +214,15 @@ export function parseColumns(
headerMap: Map<string, number>,
): Prisma.JsonValue {
if (columnNames.length === 0) return null;
+
+ // Single column: do not nest columns into json objects
+ if (columnNames.length === 1) {
+ const col = columnNames[0];
+ const rawValue = row[headerMap.get(col)!];
+ return parseValue(rawValue);
+ }
+
+ // Multiple columns: nest columns into json objects
return Object.fromEntries(
columnNames.map((col) => [col, parseValue(row[headerMap.get(col)!])]),
);