Replies: 1 comment
-
Hey - you don't quite have the right expression; I think you're mixing up
Explanation:
Hope that made sense! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
When attempting to apply
style="literal"
to JSON string values in a YAML file usingyq
, the transformation unexpectedly affects all string values, not just the targeted JSON strings, even when usingselect()
to distinguish between JSON and non-JSON values.This behavior makes it difficult to pretty-print JSON strings without inadvertently modifying other strings in the document.
Version of yq: 4.44.5
Operating system: linux
Installed via: binary release
Input Yaml
data.yml:
Command
The command I ran:
Actual behavior
Expected behavior
Workaround
A two-step
yq
command works as expected:This outputs:
Additional context
Is it possible to achieve this in a single
eval-all
command? Or is this a limitation of howstyle="literal"
andselect()
interact within a single evaluation pass? If this is intended behavior, I’d love to understand more about why it happens.I've also attempted to use
with()
, with similar results.Beta Was this translation helpful? Give feedback.
All reactions