diff --git a/src/components/json.tsx b/src/components/json.tsx index 5f3c708..a062398 100644 --- a/src/components/json.tsx +++ b/src/components/json.tsx @@ -168,7 +168,11 @@ const CollapsibleItem = (props: { const isBlobContext = props.parentIsBlob ?? ctx.parentIsBlob; const isObject = () => props.value === Object(props.value); - const isCollapsible = () => isObject() || typeof props.value === "string"; + const isEmpty = () => + Array.isArray(props.value) ? + (props.value as JSONType[]).length === 0 + : Object.keys(props.value as object).length === 0; + const isCollapsible = () => (isObject() && !isEmpty()) || typeof props.value === "string"; const summary = () => { if (typeof props.value === "string") { const len = props.value.length; @@ -188,7 +192,7 @@ const CollapsibleItem = (props: {