blazer
blazer copied to clipboard
Add basic JSON and YAML rendering in pre tag
Following on from idea: https://github.com/ankane/blazer/issues/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'
I think this is a great idea and it would be useful on projects that I'm working on.
@ankane is this something you'd look at including?