-
Notifications
You must be signed in to change notification settings - Fork 5
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
Wrong result #2
Comments
Hi @amit, thanks for taking the time to look into doing a comparison. To be perfectly honest, this implementation is pretty loose to the JSONPath specification, so I wouldn't expect a lot of queries to give an exact match to other libraries, however, I am always looking to improve it. Could you provide me with an actual response and an expected response, obviously I could do this myself, but it would be good to document it here too. Again, thanks, I will make sure to look into it. |
For the first query, Expected [ [ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
[ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
[ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
[ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8 ] Actual [ [ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
undefined,
undefined,
undefined,
undefined,
[ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
undefined,
undefined,
undefined,
undefined,
[ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
undefined,
undefined,
undefined,
undefined,
[ 1, 2, 3 ],
[ 4, 5, 6 ],
12,
13.5,
11.8,
undefined,
undefined,
undefined,
undefined ] However not completely wrong ;) From performance wise it is best among all 5 jsonpath implementation. So I'll suggest if you can complete and test it against all the scenarios. I'm excited to put it on changejs. |
Ah it failed one more test. So I'm removing it from comparison table. But hoping best for it's progress. |
@amitguptagwl: I have a fix ready to go for the previous incorrect response. Is there anywhere I can see the other test specs which you are trying? |
Try this code var arraySize = 2333,
resultCount = 150,
itemCount = 50,
groupCount = 145;
var json = {
results: []
};
var i, j;
var bigArray = [];
for (i = 0; i < arraySize; i++) {
bigArray[i] = 1;
}
var items = [];
for (i = 0; i < itemCount; i++) {
items[i] = JSON.parse(JSON.stringify({a: {b: 0, c: 0}, s: {b: {c: bigArray}}}));
}
for (i = 0; i < resultCount; i++) {
json.results[i] = {groups: [], v: {v: [1, 2, 3, 4, 5, 6, 7, 8]}};
json.results[i].groups = [];
for (j = 0; j < groupCount; j++) {
json.results[i].groups[j] = {items: items, a: "121212"};
}
}
var jp = require('@f5io/jsonpath');
console.log(jp('$.results[*].groups[*].items[42]',json)); |
Seems I have become a tester (have secured my future) ;) |
thanks, will have a look at this hopefully this evening 👍 |
Plz give a star, if it helped you a bit work |
Just so you know, I am looking at resolving the other issue. I am not sure it is my misunderstanding of the, admittedly loose, spec or the other implementations misinterpretation. I will continue looking |
Hi,
Your project may be in very early stage. But I thought to add to comparison of various jsonpath js libraries. But I seen that it gave wrong output in case of first query.
I just wanted to to inform you.
The text was updated successfully, but these errors were encountered: