mikefarah / yq

yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor
https://mikefarah.gitbook.io/yq/
MIT License
12.37k stars 603 forks source link

Error thrown by string evaluator for unexpected key when a key value is a multiline json (>- in yaml) while normal yq binary working fine #2078

Closed SachinChauhan1302 closed 5 months ago

SachinChauhan1302 commented 5 months ago

Describe the bug

Error thrown by string evaluator for unexpected key when a key value is a multiline json (>- in yaml) while normal yq binary working fine

Version of yq: 4.X.X Operating system: linux Installed via: library/binary

Input Yaml Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less) data1.yml:

 DUMMY_VALUE:
              value: >-
                {"type": "hello"}

Command The command you ran:

yq '.DUMMY_VALUE' file.yaml

While using the StringEvaluator for the yq lib using golang , it returned with an error 'did not find expected key' while yq returning with correct value. Is there a special way for such scenarios to use String Evaluator?