dasel icon indicating copy to clipboard operation
dasel copied to clipboard

Avoid string type quote stripping in yaml

Open danwt opened this issue 8 months ago • 3 comments

How to do it?

Dasel will automatically rewrite all string values in yaml without quotes, which can break some apps

e.g.

foo: "foo" becomes foo: foo

danwt avatar Apr 21 '25 14:04 danwt

Hi @danwt,

Thanks for raising this issue.

As far as I'm aware, any YAML parser should only expect quoted strings when the string contains special or reserved characters. Do you know of any apps that this doesn't work for?

TomWright avatar Jun 20 '25 14:06 TomWright

@TomWright @danwt Very new here and not sure if this has been fixed/addressed but I agree with @TomWright as far as the understanding of yaml structure. However would it make sense to add a flag to preserve quotes in the event there are apps that use them in any way?

Rickcern44 avatar Sep 14 '25 13:09 Rickcern44

I think I have encountered a practical use case where quote stripping causes issues: https://github.com/TomWright/dasel/issues/484 I have a YAML string that contains a timestamp, but I want it to remain a string literal, even though no characters are "special". If quotes are stripped, it seems to get interpreted as a timestamp.

davidselassie avatar Oct 21 '25 20:10 davidselassie