react-json-view icon indicating copy to clipboard operation
react-json-view copied to clipboard

The data on the last face cannnot collapse in very large json objects

Open GStocking opened this issue 4 years ago • 1 comments

I have a very large json objects. The previous data (small index)can be collapsed,but the data that follows(big index) cannot be collapsed。

<ReactJSONView
  displayDataTypes={false}
  name={false}
  src={testResult.testResult}
  shouldCollapse={jsonShouldCollpase}
  groupArraysAfterLength={5}
  collapseStringsAfterLength={100}
/>
export const jsonShouldCollpase = (field: any) => {
  if( field?.type ==='array' && field?.src?.length>=5 || field?.type === 'object' && Object.keys(field?.src)?.length >=5) {
    return true;
  }
  return  false
}

clipboard 微信截图_20210408154702

GStocking avatar Apr 08 '21 07:04 GStocking

+1

Savansp12 avatar Apr 09 '21 09:04 Savansp12