Page 1 of 1

wxSimpleJSON - JSON Library

Posted: Mon Jun 03, 2019 5:11 am
by evstevemd
There was old discussion about it and was rejected as part of wxWidgets. But I have been using it and it have simplified our life. Please meed wxSimpleJSON, CJSON Warapper written by Eran Ifrah with some updated

https://github.com/hosannahighertech/wxSimpleJSON

Let me know if you find it useful!

Re: wxSimpleJSON - JSON Library

Posted: Mon Jun 03, 2019 4:03 pm
by doublemax
I don't like that it consists of multiple files. Personally i'prefer a single-file, header only solution.

I use this: https://github.com/nbsdx/SimpleJSON/blo ... r/json.hpp
Of course it's not "wx aware", so you need some additional casts or encoding conversions sometimes, but i can live with that.

Re: wxSimpleJSON - JSON Library

Posted: Mon Jun 03, 2019 4:26 pm
by evstevemd
doublemax wrote: Mon Jun 03, 2019 4:03 pm I don't like that it consists of multiple files. Personally i'prefer a single-file, header only solution.

I use this: https://github.com/nbsdx/SimpleJSON/blo ... r/json.hpp
Of course it's not "wx aware", so you need some additional casts or encoding conversions sometimes, but i can live with that.
I don't know how to generate single header, if you know how, or have a pointer I will gladly do that. I know few libraries (plus SQLite3) have scripts to do that, but currently I have no time to dig into them. So any idea to get me started without reading too much is appreciated

Re: wxSimpleJSON - JSON Library

Posted: Mon Jun 03, 2019 4:32 pm
by doublemax
Honestly, i don't know if it's worth the effort. Most people probably won't care to use multiple files.

Re: wxSimpleJSON - JSON Library

Posted: Mon Jun 03, 2019 5:14 pm
by evstevemd
doublemax wrote: Mon Jun 03, 2019 4:32 pm Honestly, i don't know if it's worth the effort. Most people probably won't care to use multiple files.
I know, but you can't ignore convenience of single header library :)

I will try to find time in future and see if I can make script for that

Re: wxSimpleJSON - JSON Library

Posted: Mon Jun 03, 2019 7:38 pm
by iwbnwif
There was old discussion about it and was rejected as part of wxWidgets. But I have been using it and it have simplified our life. Please meed wxSimpleJSON, CJSON Warapper written by Eran Ifrah with some updated
I think that this library is a good idea and wish it had been accepted as part of wxWidgets as that would solve the multiple file issue.

Just as a suggestion though, why not merge the two .cpp files and three .hpp into one .cpp and one .hpp. Surely, it would then be simple enough to add those two to a project?

I appreciate that it might make it harder to maintain, but cJSON seems pretty stable, and who says that the next change won't break the wrapper code anyway.

Re: wxSimpleJSON - JSON Library

Posted: Tue Jun 04, 2019 6:49 am
by Kvaz1r
There is amalgamate project for creating single header file you also can use it.

Re: wxSimpleJSON - JSON Library

Posted: Wed Jun 05, 2019 8:12 pm
by evstevemd
iwbnwif wrote: Mon Jun 03, 2019 7:38 pm I think that this library is a good idea and wish it had been accepted as part of wxWidgets as that would solve the multiple file issue.
I agree, but then the wxTeam, didn't find it a good idea. Since I have used it with success I though sharing would be a better way of saying thank you to Eran.
iwbnwif wrote: Mon Jun 03, 2019 7:38 pm Just as a suggestion though, why not merge the two .cpp files and three .hpp into one .cpp and one .hpp. Surely, it would then be simple enough to add those two to a project?
Can you make a PR? Never done that before and am not sure how hpp file looks like ;)
iwbnwif wrote: Mon Jun 03, 2019 7:38 pm I appreciate that it might make it harder to maintain, but cJSON seems pretty stable, and who says that the next change won't break the wrapper code anyway.
CJSON doesn't change swiftly so shouldn't be a problem.

Re: wxSimpleJSON - JSON Library

Posted: Wed Jun 05, 2019 8:15 pm
by evstevemd
Kvaz1r wrote: Tue Jun 04, 2019 6:49 am There is amalgamate project for creating single header file you also can use it.
That is a cool project. I will need to find time to write unit tests to make sure the final hpp does not break somewhere.
Again thank you!