wampcc icon indicating copy to clipboard operation
wampcc copied to clipboard

consider nlohmann_json for next major release?

Open dvhwgumby opened this issue 5 years ago • 2 comments

Hey, You might want to consider switching to nlarssson's json in a future release. It makes json a C++ datatype (e.g. you just use the usual container operations on the aggregate ones, etc), is faster than jansson (and written in C++11), supports msg pack natively, and is header-only. I just wrote a shim Lohmann_json <->jalson so our code could use json and then could just pass to to wampcc through a json-json translator. nlohmann is so c++-like it's worth doing this translation to get the benefit of wampcc.

I know this isn't a trivial code change but would result in smaller code. I haven't made a pull request for such a big change but might work on this if it's interesting to you.

dvhwgumby avatar Jun 16 '20 05:06 dvhwgumby

Hello @dvhwgumby, I have wampcc integrated in two projects now and to avoid conversions between json types I have used wampcc::json_object everywhere. It is expected that many other project have done the same.

I would kindly ask if such a code change happens that it is switchable/optional during build time as it would completely break existing source codes linked to wampcc library.

infinity0n3 avatar Jun 16 '20 10:06 infinity0n3

Hi ... that would be a large change to the project, although possible to temporarily make it less disruptive by also keeping the wampcc::json_object as a wrapper. My original concern with nohlmann is that it might require later language features, so I though would be better to stick to roughly earlier modern-C++. I'll have a review. Although do note internally wampcc does use a separate C library for json, it is not an own implementation etc.

darrenjs avatar Jun 26 '20 09:06 darrenjs