diff --git a/packages/json-extension/src/component.tsx b/packages/json-extension/src/component.tsx index 5507baaf32fe..9c7e68c92f56 100644 --- a/packages/json-extension/src/component.tsx +++ b/packages/json-extension/src/component.tsx @@ -71,6 +71,17 @@ export class Component extends React.Component { }} invertTheme={false} keyPath={[root]} + getItemString={(type, data, itemType, itemString) => + Array.isArray(data) ? ( + // Always display array type and the number of items i.e. "[] 2 items". + + {itemType} {itemString} + + ) : Object.keys(data).length === 0 ? ( + // Only display object type when it's empty i.e. "{}". + {itemType} + ) : null + } labelRenderer={([label, type]) => { // let className = 'cm-variable'; // if (type === 'root') {