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

Maintain singleton sequence of array #405

Merged
merged 1 commit into from
Jan 30, 2020
Merged

Conversation

andrew-coleman
Copy link
Member

The [] syntax in a path expression should output the result sequence as an array even if the sequence contains one value (singleton sequence). However, this is not happening if that value is an array. Instead it's just using that as the result array. This PR fixes that, so that it will be enclosed in another array.

Resolves #399

Signed-off-by: andrew-coleman [email protected]

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 47840e4 on singleton_array into 34c2a09 on master.

@mattbaileyuk
Copy link
Member

For later reference, with data:

{"epochSeconds":1578381600,"value": 3}

the expression $.[value,epochSeconds][] current produces

[3, 1578381600]

when it should (and this PR will enable it to) produce

[
      [3, 1578381600]      
]

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.

Force nested arrays
3 participants