Skip to content

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

fix(ui): do not parse stringified numbers in JSON view

Marc Klingenf62752dfa769
diff --git a/src/utils/json.ts b/src/utils/json.ts
index 27caf97eb9..716291f42a 100644
--- a/src/utils/json.ts
+++ b/src/utils/json.ts
@@ -20,6 +20,7 @@ export function deepParseJson(json: unknown): unknown {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const parsed = JSON.parse(json);
+ if (typeof parsed === "number") return json; // numbers that were strings in the input should remain as strings
return deepParseJson(parsed); // Recursively parse parsed value
} catch (e) {
return json; // If it's not a valid JSON string, just return the original string