feat: Add new ReactPureJsonView component #65
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The
react-json-view
component is used more for displaying json data, that is, viewing mode, and often the displayed data comes from json files, json strings returned by APIs, etc.Currently, the
react-json-view
component propsrc
only supports objects (including arrays), which requires external personnel to convert data throughJSON.parse(json string)
. In addition, a recent commit provides big number support. The current display (JSON) data (processing results in other languages) may contain big numbers, such as 9223372036854775807, 0.0060254656709730629, etc. These areout of bounds
in javascript and need to rely on third-party special packages (json-bigint, bignumber.js) for processing.Solution
Currently, the
ReactPureJsonView
component (newly added) is provided, which can greatly improve the part of users who only display json data and avoid big number special processing logic. The propsrc
supports objects and strings. When it is an object, it is equivalent to thereact-json-view
component. When it is a string, (json-bigint, bignumber.js) parsing is automatically enabled by default.Note: This component
ReactPureJsonView
is recommended for static data presenting. It is more friendly to this scenario. This is one of the reasons why the name contains "pure"Code Example
That is so easy!
Expecting to your feedback, thank you.