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

Unpacking an array results in invalid output #3

Closed
JeanMertz opened this issue Jun 21, 2019 · 0 comments · Fixed by #5
Closed

Unpacking an array results in invalid output #3

JeanMertz opened this issue Jun 21, 2019 · 0 comments · Fixed by #5
Milestone

Comments

@JeanMertz
Copy link
Contributor

Using the following program:

.[]

Using the jq CLI, this results in:

echo '[1,2,3]' | jq .[]
1
2
3

Using json-query results in:

"123"

I was expecting to get 1\n2\n3 back (which I could then call lines() on to iterate over the results).

onelson added a commit that referenced this issue Jun 23, 2019
onelson added a commit that referenced this issue Jun 23, 2019
onelson added a commit that referenced this issue Jun 23, 2019
During #3, there was some debate about how newlines should be preserved,
especially with regards to the trailing newline at the end of the
program's output.

While the trailing newline may make the test expectations a little more
ugly, my feeling is it's more correct when compared to what the `jq`
binary itself produces. A difficult decision to make at this point is
whether or not this diff should be considered a breaking change, bumping
us up to 0.4.x or if it should be a plain bugfix, continuing the current
0.3.x line.

Best as I can tell, callers who are relying on feeding the output into a
parser such as serde will not see any impact. The only callers who may
have been impacted are those who are doing string matching on the raw
string. I'm going to sleep on the matter of which digit to bump the
version by. I may use this as an opportinity to make some other changes
with the opening this creates, perhaps in error handling.
@onelson onelson added this to the v0.3.1 milestone Jun 23, 2019
onelson added a commit that referenced this issue Jul 5, 2019
During #3, there was some debate about how newlines should be preserved,
especially with regards to the trailing newline at the end of the
program's output.

While the trailing newline may make the test expectations a little more
ugly, my feeling is it's more correct when compared to what the `jq`
binary itself produces. A difficult decision to make at this point is
whether or not this diff should be considered a breaking change, bumping
us up to 0.4.x or if it should be a plain bugfix, continuing the current
0.3.x line.

Best as I can tell, callers who are relying on feeding the output into a
parser such as serde will not see any impact. The only callers who may
have been impacted are those who are doing string matching on the raw
string. I'm going to sleep on the matter of which digit to bump the
version by. I may use this as an opportinity to make some other changes
with the opening this creates, perhaps in error handling.
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 a pull request may close this issue.

2 participants