Skip to content

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 andrew_coleman@uk.ibm.com

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
@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

4 participants