Skip to content

Commit

Permalink
displaying size of arrays and nr root level in title
Browse files Browse the repository at this point in the history
  • Loading branch information
Barabasbalazs committed Oct 14, 2024
1 parent ce5e4f3 commit d69d8c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Results/Hit.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,15 @@ function getFieldValueType(value) {

const FieldValue = ({ hit, objectKey }) => {
const fieldValueType = getFieldValueType(hit[objectKey])
const sizeOfObject = Object.keys(hit[objectKey])?.length || 0

if (fieldValueType === 'array') {
return (
<JsonRepresentor
value={hit[objectKey]}
hit={hit}
attribute={objectKey}
title="array"
title={`array [${sizeOfObject}]`}
reactJsonOptions={{ groupArraysAfterLength: 20, displayArrayKey: true }}
/>
)
Expand All @@ -167,7 +168,7 @@ const FieldValue = ({ hit, objectKey }) => {
value={hit[objectKey]}
hit={hit}
attribute={objectKey}
title="json"
title={`json [${sizeOfObject}]`}
reactJsonOptions={{ displayArrayKey: false }}
/>
)
Expand Down

0 comments on commit d69d8c2

Please sign in to comment.