-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Consider replacing jsoncpp #6900
Comments
wrt. nlohmann/json, they state Also the examples he provides in the readme look very convincing to me. => 👍 for this one. |
I had a quick look over nlohmann and found the following two items that might be issues:
|
I think while the insertion order of the keys is not preserved, they don't have an "undefined" order - they use a Regarding comments I'm not sure - should we allow them even though they are actually not valid json? I know that json-cpp only supports them in a weird way as well (whether a comment is fine depends on whether it's key-comment-comma or key-comma-comment, if I recall correctly). |
Hi, I'm the author for nlohmann/json. Please let me know if you need any assistance! |
@nlohmann great to have you here! Can you comment on the order of keys? Is it a defined order that may be different from the insertion order or can it depend on things like memory layout? |
We use an |
Wonderful, thanks! |
Ah nice, I just found this issue. @ekpyron I had the same impression and I think it would be nice to replace |
As I wrote earlier, just let me know if you need assistance! |
I brought this up in our weekly call earlier and @chriseth said we should postpone this until after 0.6.0 is released. |
nlohmann's seems to be better in every single benchmark compared to jsoncpp: https://github.com/miloyip/nativejson-benchmark |
Are benchmarks the benchmark? I would say it is more important that the code is easy to understand and does not create any ambiguities. |
I think the API of nlohman was quite good, even compared to jsoncpp. The benchmark categories are:
There is a huge difference between speeds, which can be an issue with large compilations (large JSON outputs or input). I think this may be the reason people were complaining on compilation speed. |
By the way: @Marenz is having problems problems with the performance of the AST export and import tests, for which I think the json parsing and emitting part is a major bottleneck - so it's not like performance is entirely irrelevant... and regarding readability: just have a quick look at aarlt@1329c25 - the API is very similar to jsoncpp and closer to STL, which I'd consider an advantage. |
I would say there is no point supporting comments when they are not a valid JSON feature. IIRC we have them disabled as much as jsoncpp allows disabling them. Also apparently nlohman-json now supports CBOR integration: https://github.com/nlohmann/json#binary-formats-bson-cbor-messagepack-and-ubjson This means we could in theory replace our code or at least replace it in the tests. However this is not a pressing issue as our small CBOR code works well and as intended. |
Dropping another suggestion that favors performance: https://github.com/simdjson/simdjson The API is also quite straight forward. |
just curious, what is https://github.com/ethereum/solidity/blob/develop/scripts/install_obsolete_jsoncpp_1_7_4.sh and why does it exist? |
It used to be needed in CI on macOS and older Ubuntu versions: #4073 . For Ubuntu It was later replaced with a package (#6453). For macOS we still use it though. osx_install_dependencies.sh runs that script. I'm not completely sure why macOS needs specifically 1.7.4 but there's a comment comment in one of these PRs saying that it's somehow related to how we download and build it on our own during cmake setup:
|
This issue has been marked as stale due to inactivity for the last 90 days. |
I'm going to keep this one open. It may not be high on our priority list, but I think we should move away from jsoncpp eventually. |
This issue has been marked as stale due to inactivity for the last 90 days. |
Hi everyone! This issue has been automatically closed due to inactivity. |
This was implemented by #14877. |
I'd suggest to consider replacing jsoncpp with either http://rapidjson.org/ or https://github.com/nlohmann/json (or any other of the available candidates).
Is there any reason for staying with jsoncpp other than the required work a move would be (which I wouldn't expect to actually be too bad)?
Closes #3557.
The text was updated successfully, but these errors were encountered: