You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say you have an array of objects:
[ { id: 1, a: 'A'}, { id: 2, a: 'B'}, { id: 3, a: 'C'} ]
You want to get with jpaths the following output:
[ 1, 2, 3 ]
Because you're interested in the ids of each row for instance.
Currently there's no way to do it automatically. I suggest that instead of proposing elements 0,1,2,3 and 4 in the jpath selector, we add the option "all" (value=-1) which gives forces the array output.
Example
Source: [ { id: 1, a: 'A'}, { id: 2, a: 'B'}, { id: 3, a: 'C'} ]
with element.0.id it would give 1
with element.-1.id it would give [ 1, 2, 3 ]
with element.0.a it would give [ { a: 'A', b: 'B', c: 'C' } ]
with element.-1.a.0.a it would give [ 'A', 'D', 'G' ]
with element.-1.a.-1.a it would give [ [ 'A', 'A2' ], [ 'D', 'D2' ], [ 'G', 'G2' ] ]
The text was updated successfully, but these errors were encountered:
Ok here's the problem.
Say you have an array of objects:
[ { id: 1, a: 'A'}, { id: 2, a: 'B'}, { id: 3, a: 'C'} ]
You want to get with jpaths the following output:
[ 1, 2, 3 ]
Because you're interested in the ids of each row for instance.
Currently there's no way to do it automatically. I suggest that instead of proposing elements 0,1,2,3 and 4 in the jpath selector, we add the option "all" (value=-1) which gives forces the array output.
Example
Source: [ { id: 1, a: 'A'}, { id: 2, a: 'B'}, { id: 3, a: 'C'} ]
with element.0.id it would give 1
with element.-1.id it would give [ 1, 2, 3 ]
Source:
[
{ id: 1, a: [ { a: 'A', b: 'B', c: 'C' }, { a: 'A2', b: 'B2', c: 'C2' } ] },
{ id: 2, a: [ { a: 'D', b: 'E', c: 'F' }, { a: 'D2', b: 'E2', c: 'F2' } ] ,
{ id: 3, a: [ { a: 'G', b: 'H', c: 'I' }, { a: 'G2', b: 'H2', c: 'I2' } ] }
]
with element.0.a it would give [ { a: 'A', b: 'B', c: 'C' } ]
with element.-1.a.0.a it would give [ 'A', 'D', 'G' ]
with element.-1.a.-1.a it would give [ [ 'A', 'A2' ], [ 'D', 'D2' ], [ 'G', 'G2' ] ]
The text was updated successfully, but these errors were encountered: