jquery.json-viewer icon indicating copy to clipboard operation
jquery.json-viewer copied to clipboard

Provide option for showing the spaces after keys

Open tdauth opened this issue 2 years ago • 2 comments

Hi, when I have the following JSON content:

"x" : 10

this viewer shows it as:

"x": 10

and removes the space character after the key. Can you provide an option to keep the space? It would be helpful when copying the JSON to keep it more similar to the original.

tdauth avatar Feb 01 '23 15:02 tdauth

Hi @tdauth This plugin does not cover parsing text to a JSON object, the jsonViewer function expects a valid JSON object, not text. Which means the HTML renderer has no info about the original formatting, if any!

An option to enforce a space before colon character in the renderer would possible though, but I'm unsure this is what you're looking for.

abodelot avatar Feb 05 '23 18:02 abodelot

Yes this option would be sufficient. You could also make it more generic like:

beforeColon: ' ',
afterColon: ' ',

so the user can specify the characters before and after manually.

tdauth avatar Mar 21 '23 13:03 tdauth