-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bug: arrays of arrays get flattened #1
Comments
Yes it is intentional. It would be a lot more difficult to handle returned values if they where broken down by their parent containers. Flattened output ensures consistent handling regardless of where the match was found. |
I understand your point, although it still is somehow 'conceptually wrong' in my opinion. Let me try to change your mind :-D My example was simple just not to require you to study the more complicated source I am using jpath in (http://dico.im/180640w). I am using jpath to 'subset' the responses I get from calling a commercial API. As such, I have no control on the design of the API whatsoever. Unfortunately the API designers decided to return its results in that array of arrays format for one specific API call. By unsolicitedly flattening the array, jpath 'breaks' the format of the original API, hence its results do not correspond any longer to the documentation, which in turn creates unexpected results in the client application. This is a problem for me, but also for any other future user of jpath who will find herself in my same situation. What do you reckon? If your main motivation in writing jpath is just your own use, of course I can't argue with that. But if your objective is to offer a universal - and incredibly useful by the way - XPath-like filter, then you can't arbitrarily change the format of the input object because it is 'simpler'. In any case, great work. I know that I may fork your project and make it work the way I believe is right, but I have not been a developer for many years and it would take days to me. I really hope I can convince you :-) Giacecco |
Ok, I'll take a look at it again :) This code is such a mind-hog to consume yourself in. |
Thanks, and I can imagine how tricky the source must be. Let me know if I can help somewhere it is more suitable to a newbie. |
See the example below.
I would expect that to return:
Instead, it returns:
Is that intentional? Thanks.
Giacecco
The text was updated successfully, but these errors were encountered: