Skip to content
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

Alignment on JSONPath implementations across languages #199

Closed
cburgmer opened this issue Dec 10, 2019 · 7 comments
Closed

Alignment on JSONPath implementations across languages #199

cburgmer opened this issue Dec 10, 2019 · 7 comments

Comments

@cburgmer
Copy link

Hi there, I've started comparing all JSONPath implementations I can find to each other: https://cburgmer.github.io/json-path-comparison/.
I'm hoping to start some alignment in the hopes that implementations get a bit more uniform in their interpretation of the standard. I've implemented a lot of adapters for the different languages, I'm just not sure I can get this done for C++. So, contrary to the other libraries I wanted to suggest, that if you are interested to take part in the comparison, maybe you can kick off with an adapter? I would be happy to help. There's some documentation under https://github.com/cburgmer/json-path-comparison#add-an-implementation already.

Part of the project is a set of regression tests, which should allow any library to be tested against the big set of queries already implemented there. Happy also for feedback.

@danielaparker
Copy link
Owner

How would you install the source (include files) from the jsoncons repository? Is support for a particular package manager required?

@cburgmer
Copy link
Author

Most implementations go via the language's package manager (e.g. https://github.com/cburgmer/json-path-comparison/blob/master/implementations/Ruby_jsonpath/build.ninja), the Bash implementation uses curl (https://github.com/cburgmer/json-path-comparison/blob/master/implementations/Bash_JSONPath.sh/install.sh), the C implementation cheats by using the distribution's (Alpine for docker, locally depends on your OS) way of installing the source (https://github.com/cburgmer/json-path-comparison/blob/master/src/Dockerfile#L25).

@danielaparker
Copy link
Owner

Can you use vcpkg for install? Currently, this is the only package manager that jsoncons supports.

@cburgmer
Copy link
Author

Thanks for checking.

It seems there are no binaries available so we would need to install from scratch. In this case that IMHO should be part of the library's build step itself. I wouldn't want to require any developer having to figure out for themselves how to build it. (Something part of the Dockerfile should currently also be installable manually if somebody decided not to go with Docker, for the sake of simplicity.)

I tried installing vcpkg locally on OS X but it seems it's not only incompatible with GCC (fixable) but with OS X 10.14 (../include/vcpkg/base/files.h:57:41: error: 'file_status' is unavailable: introduced in macOS 10.15). For me this means I can currently not give you a thumbs up on how easy that would be to use across operating systems.

I can promise to upgrade to OS X 10.15 the next few days, knowing though that there are known breaking changes in that OS version, which makes that a non-trivial one. If you want to wait, I can take care of that the next few days.

@danielaparker
Copy link
Owner

danielaparker commented Dec 12, 2019

If there's a C++ package manager that you can use, and someone is able to contribute the required files to make jsoncons available through that package manager, I should be able to take responsibility for that going forward. But I'd need some help with this.

@cburgmer
Copy link
Author

I've built a tiny implementation which will fetch the tar from the Github releases page (https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Cpp_jsoncons). Here are two quick findings:

  • $..*
    Input:
    {"key": "value", "another key": {"complex": "string", "primitives": [0, 1]}}
    
    Expected output:
    ["string", "value", 0, 1, [0, 1], {"complex": "string", "primitives": [0, 1]}]
    
    Actual output:
    ["value", {"complex": "string", "primitives": [0, 1]}]
    

And for $['key','another'] many implementations return a list of the two matches in order. Jsoncons however returns the same elements but in reverse order, compare https://cburgmer.github.io/json-path-comparison/results/key_bracket_notation_union.html and https://cburgmer.github.io/json-path-comparison/results/key_bracket_notation_union_with_key_on_nested_objects.html.

@danielaparker
Copy link
Owner

danielaparker commented Dec 23, 2019

Thanks for the feedback! The two issues reported above have been fixed in the latest release, 0.142.0.

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

No branches or pull requests

2 participants