Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
855 stars 233 forks source link

Support for jsoncpp #291

Closed lianyant closed 8 months ago

lianyant commented 1 year ago

What's your question?

Can we use the jsoncpp library?

Additional Context

I would like to introduce the jwt cpp library into my project and use the jsoncpp library that is already in use in my local project. Is this okay?

Thalhammer commented 1 year ago

jsoncpp isn't directly supported in the way that we ship a trait for it, however if it has an api similar to most other JSON libraries out there you should be able to adopt one of the traits in the traits folder pretty easily and then use it instead of the default traits. If you do consider contributing it back by doing a pr (or simply post it under this issue) and we will add it to the official release eventually.

If thats not an option for whatever reason you can use the default picojson library for jwt and jsoncpp for the rest, they shouldn't collide and picojson is fairly light.

lianyant commented 1 year ago

Due to my unfamiliarity with the jsoncpp library and the fact that its APIs are somewhat different, some types do not exist in jsoncpp library, or the type names are different. So I took your suggestion and used the default picojson library. Thank you very much for your answer. This issue has been resolved.

prince-chrismc commented 1 year ago

Glad you are unblocked. I'll leave this open in case other want it too they can chime in and hopefully contribute 🤞

cjserio commented 8 months ago

I just made a pull request with these traits. https://github.com/Thalhammer/jwt-cpp/pull/317