How to convert an NDJSON stream to a YAML stream? #1279
Unanswered
anatoly-scherbakov
asked this question in
Q&A
Replies: 2 comments
-
At the moment, that's the only way (using xargs). I've just started looking into json decoders - and found that go's built in decoder supports NDJSON! I'll start working on adding a specific json decoder, once it's in you'll need to specify the decoder with a |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've added the decoder in v4.27.1 :) Just use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thank you for the great tool!
I am trying to convert an NDJSON file (also known as JSON Sequence) with the following content to YAML:
I expect to see:
yq
doesn't acceptsample.ndjson
as a valid input:yq
treats JSON as a subset of YAML, but NDJSON isn't such a subset, hence the error. Is there any known compact way to achieve this conversion besides processing each line separately usingxargs
and then inserting document separators? Thank you!Beta Was this translation helpful? Give feedback.
All reactions