mikefarah / yq

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

Unexpected order when adding multiple elements to array #2143

Open ryenus opened 2 months ago

ryenus commented 2 months ago

Describe the bug

When trying to sequentially append two objects to an array, say array + o1 + o2, instead of appending o1 then appending o2, yq combined the objects o1 and o2, then appended the new object to the array.

Version of yq: 4.44.3 Operating system: mac Installed via: homebrew

Input Yaml N/A

Command

The command you ran:

yq -n '[] + {"a":1} + {"b":2}'

Actual behavior

- a: 1
  b: 2

Expected behavior

- a: 1
- b: 2

Additional context Add any other context about the problem here.