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
212 stars 12 forks source link

Parsing a string text results in an array of characters #50

Open mschipperheyn opened 5 months ago

mschipperheyn commented 5 months ago

If you try to display a regular string with JsonView (sometimes you can't predict the input), it renders an array of characters. I would expect the string in an "illegal scenario" to be rendered as is.

jaywcjlove commented 5 months ago

@mschipperheyn I cannot reproduce the error you described, please provide an example that can reproduce the error.

mschipperheyn commented 5 months ago

I've added a sandbox here

IMHO JsonView should deal with plain strings in a way that displays it normally

jaywcjlove commented 5 months ago
image

@mschipperheyn This package is for JSON preview, not a string preview tool.

- <ReactJsonView value="data" />;
+ <ReactJsonView value={{ a: "data" }} />;