Skip to content

Modifies jsonEncodingStream to construct an array#19

Open
reidmiller-geotab wants to merge 1 commit intoocpi:mainfrom
reidmiller-geotab:format-json-output-as-array
Open

Modifies jsonEncodingStream to construct an array#19
reidmiller-geotab wants to merge 1 commit intoocpi:mainfrom
reidmiller-geotab:format-json-output-as-array

Conversation

@reidmiller-geotab
Copy link

Currently, when using a command like:

node ./dist/index.js get locations

Multiple items are output as:

{ "foo": "bar1"} { "foo": "bar2"}

This is not a syntactically valid array. When piped to jq, as suggested by the README, something as simple as the following throws an error:

node ./dist/index.js get locations | jq .

This is due to the array syntax error. The output should be:

[ { "foo": "bar1"}, {"foo": "bar2"} ]

This commit modifies the jsonEncodingStream to construct a syntactically valid array.

I haven't done super thorough testing yet. I think this implementation might be a bit brittle. So far, it's working for me when tested against small collections.

Currently, when using a command like:

node ./dist/index.js get locations

Multiple items are output as:

{ "foo": "bar1"} { "foo": "bar2"}

This is not a syntactically valid array. When piped to jq, as
suggested by the README, something as simple as the following
throws an error:

node ./dist/index.js get locations | jq .

This is due to the array syntax error. The output should be:

[{ "foo": "bar1"} ,{ "foo": "bar2"}]

This commit modifies the jsonEncodingStream to construct
a syntactically valid array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments