- {typeof value === 'string' || typeof value === 'number' ? (
- value
- ) : (
-
- {JSON.stringify(value, null, 2)}
-
- )}
-
-
- ))}
+ {Object.entries(object).map(([key, value]) => {
+ // `Parent` is a back-reference added during traversal; it creates a
+ // cycle with `ContainedObjects`, so skip it in the default view.
+ if (key === 'Parent') return null;
+ return (
+
+
{key}
+
+ {typeof value === 'string' || typeof value === 'number' ? (
+ value
+ ) : (
+
+ {safeStringify(value)}
+
+ )}
+
+
+ );
+ })}
);
+}
+
+/** JSON-stringify a value, replacing any circular references with a marker. */
+function safeStringify(value: unknown): string {
+ const seen = new Set