bronze1man / yaml2json

a command line tool convert from yaml to json
MIT License
226 stars 45 forks source link

YAML stream to JSON array #19

Open bryanlarsen opened 5 years ago

bryanlarsen commented 5 years ago

If you run yaml2json on a multi-document YAML file, the output is not valid JSON. It'd be nice to have an option to output an array instead of a JSON stream.

Not a big deal, an easy workaround is to pipe it to jq -s

foo | yaml2json | jq -s -r .
bronze1man commented 5 years ago

Please give a multi-document YAML file example that will cause the problem, so i can add a test as your case. I do not know how to write a multi-document YAML file...

dosmanak commented 2 years ago

multidocument yaml file is delimited with ---

---
a: hello
obj:
  nested:
    - 1
    - 2
---
anotheryaml:
  here: defined

But jq can handle json stream AFAIK