diff --git a/sim/app/w/[id]/components/panel/components/console/components/console-entry/console-entry.tsx b/sim/app/w/[id]/components/panel/components/console/components/console-entry/console-entry.tsx
index ad977edf2..7e56e7bc2 100644
--- a/sim/app/w/[id]/components/panel/components/console/components/console-entry/console-entry.tsx
+++ b/sim/app/w/[id]/components/panel/components/console/components/console-entry/console-entry.tsx
@@ -1,6 +1,16 @@
import { useMemo, useState } from 'react'
import { format } from 'date-fns'
-import { AlertCircle, AlertTriangle, Calendar, CheckCircle2, Clock, Terminal } from 'lucide-react'
+import {
+ AlertCircle,
+ AlertTriangle,
+ Calendar,
+ CheckCircle2,
+ ChevronDown,
+ ChevronUp,
+ Clock,
+ Terminal,
+} from 'lucide-react'
+import { Button } from '@/components/ui/button'
import { ConsoleEntry as ConsoleEntryType } from '@/stores/panel/console/types'
import { getBlock } from '@/blocks'
import { JSONView } from '../json-view/json-view'
@@ -47,6 +57,7 @@ const WordWrap = ({ text }: { text: string }) => {
export function ConsoleEntry({ entry, consoleWidth }: ConsoleEntryProps) {
const [isExpanded, setIsExpanded] = useState(false)
+ const [expandAllJson, setExpandAllJson] = useState(false)
const blockConfig = useMemo(() => {
if (!entry.blockType) return null
@@ -63,6 +74,22 @@ export function ConsoleEntry({ entry, consoleWidth }: ConsoleEntryProps) {
)
+ // Helper function to check if data has nested objects or arrays
+ const hasNestedStructure = (data: any): boolean => {
+ if (data === null || typeof data !== 'object') return false
+
+ // Check if it's an empty object or array
+ if (Object.keys(data).length === 0) return false
+
+ // For arrays, check if any element is an object
+ if (Array.isArray(data)) {
+ return data.some((item) => typeof item === 'object' && item !== null)
+ }
+
+ // For objects, check if any value is an object
+ return Object.values(data).some((value) => typeof value === 'object' && value !== null)
+ }
+
return (
-
-
+
+ {typeof entry.output === 'object' &&
+ entry.output !== null &&
+ hasNestedStructure(entry.output) && (
+
+
+
+ )}
+
)}
diff --git a/sim/app/w/[id]/components/panel/components/console/components/json-view/json-view.tsx b/sim/app/w/[id]/components/panel/components/console/components/json-view/json-view.tsx
index 84017cc2f..188706a19 100644
--- a/sim/app/w/[id]/components/panel/components/console/components/json-view/json-view.tsx
+++ b/sim/app/w/[id]/components/panel/components/console/components/json-view/json-view.tsx
@@ -355,7 +355,11 @@ export const JSONView = ({ data, level = 0, initiallyExpanded = false }: JSONVie
/>
) : (
-
+
)}
{index < Object.entries(data).length - 1 && ','}
@@ -470,7 +474,11 @@ export const JSONView = ({ data, level = 0, initiallyExpanded = false }: JSONVie
/>
) : (
-
+
)}
{idx < Object.entries(value).length - 1 && ','}
@@ -481,7 +489,11 @@ export const JSONView = ({ data, level = 0, initiallyExpanded = false }: JSONVie
{'}'}
) : (
-
+
)}
{index < Object.entries(data).length - 1 && ','}
@@ -577,7 +589,7 @@ export const JSONView = ({ data, level = 0, initiallyExpanded = false }: JSONVie
{isArray
? items.map((item, index) => (
-
+
{index < items.length - 1 && ','}
))
@@ -594,7 +606,11 @@ export const JSONView = ({ data, level = 0, initiallyExpanded = false }: JSONVie
) : (
-
+
)}
{index < items.length - 1 && ','}