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

Add basic JSON and YAML rendering in pre tag #389

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cianmce
Copy link
Contributor

@cianmce cianmce commented Feb 24, 2022

Following on from idea: #388

If a column name contains JSON or YAML then do the appropriate parsing and pretty-printing, if parsing fails then just return the value in a pre tag and highlight using hljs

We could also add config to explicitly enable or disable this, similar to what is done with image


Sample SQL using MySQL data source

SELECT
  'test: {"k2": "v2", "k3": {"k4": "v4"}}\ntest2: [1,2]' AS sample_yaml,
  '{"test":{"k2":"v2","k3":{"k4":"v4"}},"test2":[1,2]}' AS sample_json,
  'test_content' AS sample_text
UNION
SELECT 'invaid: yaml\nobject', '{"invalid": "json"', 'more_text'

image

@jpaulomotta
Copy link

I think this is a great idea and it would be useful on projects that I'm working on.

@cianmce
Copy link
Contributor Author

cianmce commented Nov 24, 2023

@ankane is this something you'd look at including?

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

Successfully merging this pull request may close these issues.

3 participants