jaq icon indicating copy to clipboard operation
jaq copied to clipboard

Support YAML

Open 01mf02 opened this issue 2 years ago • 3 comments

The main difference between serde_json and serde_yaml seems to be that in YAML, map keys can be any value, whereas in JSON, map keys can be only strings.

We could lift the restriction on the key type to allow for YAML support quite quickly; however, the main blocker seems to be colored output of YAML values. This would then require a crate like colored_yaml --- which does not exist for now.

01mf02 avatar Jun 07 '22 07:06 01mf02

@01mf02 There is syntect which provides syntax highlighting for YAML as well. It's a pretty heavyweight dependency though, so not sure if this is what you are looking for.

martinohmann avatar Jun 17 '22 23:06 martinohmann

@martinohmann: Thanks for the suggestion, but I suppose that this solution would be too slow, because it would require outputting YAML first as text, then parsing it with syntect, and only then outputting it.

01mf02 avatar Jun 20 '22 16:06 01mf02

I think it would be beneficial to add support for YAML even without colors at first. If you want, you could just hide support for YAML before some runtime experimental flag (--experimental-yaml or something like it), so people would adjust their expectations accordingly.

yerke avatar Oct 15 '23 20:10 yerke