JSONPath icon indicating copy to clipboard operation
JSONPath copied to clipboard

Union With Wildcard And Number

Open SoftCreatR opened this issue 5 years ago • 5 comments

Test Data:

[
   "first",
   "second",
   "third",
   "forth",
   "fifth"
]

Selector:

$[*,1]

Resul:

Unable to parse token *,1 in expression: [*,1]

Expected result (Proposal A):

[
   "first",
   "second",
   "third",
   "forth",
   "fifth",
   "second"
]

https://cburgmer.github.io/json-path-comparison/results/union_with_wildcard_and_number.html

SoftCreatR avatar Nov 03 '20 14:11 SoftCreatR

Can you tell me what is meant by 'consensus'. For example in the link below: https://cburgmer.github.io/json-path-comparison/results/union_with_wildcard_and_number.html

Amoldreamer avatar Nov 07 '20 03:11 Amoldreamer

See it as expected result.

SoftCreatR avatar Nov 07 '20 03:11 SoftCreatR

ok

Amoldreamer avatar Nov 07 '20 03:11 Amoldreamer

Then what does it mean if the consensus is "not supported"?

Amoldreamer avatar Nov 07 '20 04:11 Amoldreamer

That's in fact just another consensus and simply means, that most implementations do not support this query.

An example: Let's assume a math problem:

5 + 1 = ?

There are multiple ways to calculate it, but no way is guaranteed to provide the correct result. So let's assume, there are 5 ways to calculate the result:

The first way gives 6 The 2nd way gives 6 The 3rd way gives 5 The 4th way gives 6 The 5th way gives 7

Without knowing, what the expected result is, we assume it's 6, because that's the consensus of all possible ways is 6.

I hope, this answers your question.

However, in this specific case, "Not supported" isn't really a desirable result. That's why we use the result from Proposal A. There's still no guarantee, that this is the result we should expect, but it's pretty likely, that it's result is, what most people would expect, when executing the given query.

SoftCreatR avatar Nov 07 '20 04:11 SoftCreatR