diff --git a/src/components/json.tsx b/src/components/json.tsx
--- a/src/components/json.tsx
+++ b/src/components/json.tsx
@@ -146,14 +146,6 @@
);
};
-const JSONBoolean = ({ data }: { data: boolean }) => {
- return {data ? "true" : "false"};
-};
-
-const JSONNull = () => {
- return null;
-};
-
const CollapsibleItem = (props: {
label: string | number;
value: JSONType;
@@ -182,10 +174,8 @@ if (Array.isArray(props.value)) {
const len = (props.value as JSONType[]).length;
return `[ ${len} ${len === 1 ? "item" : "items"} ]`;
}
- if (isObject()) {
- const len = Object.keys(props.value as object).length;
- return `{ ${len} ${len === 1 ? "key" : "keys"} }`;
- }
+ const len = Object.keys(props.value as object).length;
+ return `{ ${len} ${len === 1 ? "key" : "keys"} }`;
};
return (
@@ -356,6 +346,9 @@
);
};
+ if (Object.keys(props.data).length === 0)
+ return {"{ }"};
+
if (blob.$type === "blob") {
return (
<>
@@ -371,6 +364,8 @@ return rawObj;
};
const JSONArray = (props: { data: JSONType[] }) => {
+ if (props.data.length === 0)
+ return [ ];
return (
{(value, index) => }
@@ -388,14 +383,9 @@ const data = props.data;
if (typeof data === "string")
return ;
if (typeof data === "number") return ;
- if (typeof data === "boolean") return ;
- if (data === null) return ;
- if (Array.isArray(data))
- return data.length === 0 ?
- [ ]
- : ;
- if (Object.keys(data).length === 0)
- return {"{ }"};
+ if (typeof data === "boolean") return {String(data)};
+ if (data === null) return null;
+ if (Array.isArray(data)) return ;
return ;
};