Skip to content

new behaviour since v4.32.1: input json produces output json by default instead of yaml #1608

Description

@vbehar

Describe the bug

since https://github.com/mikefarah/yq/releases/tag/v4.32.1 and more specifically #1582 a JSON input file is now auto-detected as JSON - instead of the previous YAML default format.

which implies that the output is automatically set to JSON format - instead of being YAML previously (= in the previous versions)

the impact is that for a single output value, the result is now wrapped in quotes.

Version of yq: 4.32.1
Operating system: mac and linux
Installed via: binary release and homebrew

Input JSON
data.json:

{"version": "1.2.3"}

Command
The command you ran:

yq '.version' data.json

Actual behavior

"1.2.3"

Expected behavior

1.2.3

(which was the actual behaviour in v4.31.2 and older versions)

Additional context

  • forcing a YAML output "fixes" the issue: yq -oy '.version' test.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions