Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to show quotes around strings #1516

Open
dhruvkb opened this issue May 13, 2023 · 1 comment
Open

Option to show quotes around strings #1516

dhruvkb opened this issue May 13, 2023 · 1 comment

Comments

@dhruvkb
Copy link

dhruvkb commented May 13, 2023

The API we work with returns a JSON with a bunch of fields. Sometimes it deals with numbers that may be sent as a string, especially where the number of digits (and any leading zeroes) are important to be preserved.

For example, there are cases where an ID needs to be 5 characters so a 4-digit ID is sent as "01234". But the UI makes it hard to know whats a string and what's a number because neither are quoted.

{
  "num_id": 1234,
  "str_id": "01234",
}

is rendered as

Screenshot 2023-05-13 at 1 27 06 PM

It would be nice if there was an option to show quotes for string values in the tree UI.

@josdejong
Copy link
Owner

Thanks for sharing your idea, showing the quotes can be helpful indeed. It will also give a more crowded view, so it is a tradeoff.

Note that in the successor of this library, svelte-jsoneditor, you can implement your own renderer for values using onRenderValue. That allows defining some custom renderer that encloses string values in quotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants