bronze1man / yaml2json

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

Add Support For YAML Streams #9

Closed hohle closed 6 years ago

hohle commented 6 years ago

Emits a "stream" of JSON records (compatible with something like RecordStream) when encountering a YAML stream instead of just emitting the first record.

For example, if I keep a YAML stream of event data, I might want to aggregate that using tools that prefer to speak JSON:

pv /path/to/my-yaml-stream \
   | yaml2json \
   | grep -v '"Function":"FooBar:"' \
   | recs grep ' {{Deeply/Nested/Group}}' \
   | recs xform '$r = {Function => {{Function}}, Group => {{Deeply/Nested/Group}} }' \
   | recs totable -k 'Function,Values/#0,Values/#1' --spreadsheet

go is not a language I am terribly familiar with, so please excuse any glaring language or idiom issues. I'm happy to fix.

bronze1man commented 6 years ago

Please provide a test input with the "stream" of yaml . I can not find a working one. I can not add a test that can be streamed.