Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml document separator --tojson creates literal '---' which is not json compatible ... #735

Closed
PaulCharlton opened this issue Feb 26, 2021 · 3 comments
Labels
Milestone

Comments

@PaulCharlton
Copy link

PaulCharlton commented Feb 26, 2021

Describe the bug
A clear and concise description of what the bug is.

yq -V
yq version 4.6.1

input file consisting of document separators and no tags
1.yaml

---
---

** command **

yq eval-all --tojson 1.yaml

Actual behavior

produces:

null
---
null

Expected behavior

null
null
{}
{}

or, alternatively, 2 blank lines (like "// empty" in jq). The literal '---' is not parseable by jq

@PaulCharlton
Copy link
Author

I imagine the point would be for "--tojson" to strip document start when combining documents with 'eval-all'

@PaulCharlton PaulCharlton changed the title empty document --tojson creates literal 'null' which is not an empty json ... yaml document separator --tojson creates literal '---' which is not json compatible ... Feb 27, 2021
@mikefarah
Copy link
Owner

Yeah fair call - for the moment, you can use the -N/--no-doc to get rid of the separators, next release will do that by default

@mikefarah mikefarah added this to the 4.6.2 milestone Mar 19, 2021
@mikefarah
Copy link
Owner

mikefarah commented Mar 19, 2021

Fixed in 4.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants