uiwjs / react-json-view

A React component for displaying and editing javascript arrays and JSON objects.
https://uiwjs.github.io/react-json-view/
MIT License
188 stars 11 forks source link

Feature Request: string shortening #12

Closed CamdenFoucht closed 1 year ago

CamdenFoucht commented 1 year ago

It would be great if we could have some prop like shortenTextAfterLength to shorten long JSON strings after a desired length:

my not very long long string example

providing shortenTextAfterLength to 10 would render

my not very...

with the ability for users to expand/collapse the string. This would give a much better view for JSON objects that might have strings that are 1000+ characters long

jaywcjlove commented 1 year ago

@CamdenFoucht Upgrade v1.9.0

https://github.com/uiwjs/react-json-view/blob/9c03a58d97b070c6f0d315d0e3e4ca79e1074e23/core/src/index.tsx#L43-L44

CamdenFoucht commented 1 year ago

Wow that was fast! Thank you, that is perfect!