cbor / cbor.github.io

cbor.io web site
74 stars 33 forks source link

JSON for Modern C++ 2.0.9 supports CBOR #25

Closed nlohmann closed 7 years ago

nlohmann commented 7 years ago

The latest release of JSON for Modern C++ - a header-only C++ library that aims to promote JSON to a first-class data type in C++11 - now supports CBOR as (de)serialization format.

Examples for the usage:

It would be great if you could list us in the implementation section of your website. Furthermore, any feedback is greatly appreciated.

cabo commented 7 years ago

Thank you for the pointer!

Do you plan to implement any of the parts of CBOR where the generic data model extends that of JSON? E.g., byte strings, non-text-string map keys, tags, simple values beyond null/false/true?

It would be nice to use your library to implement COSE and CWTs.

nlohmann commented 7 years ago

Currently, there is no support beyond JSON planned. We allow any JSON value to be serialized to CBOR and to deserialized them again. There was some discussion regarding byte strings, but we decided not to implement different encoding schemes.

May I ask what COSE and CWTs are?

cabo commented 7 years ago

COSE is CBOR Object Signing and Encryption (as with JOSE, but benefitting from the more extensive generic data model of CBOR). CWTs are JWTs using COSE. COSE is pretty much done in the IETF (RFC soon; see https://tools.ietf.org/html/draft-ietf-cose-msg-24 for now); CWTs still require a little bit of work. These structures are the basis of secure low-resource IoT.

cabo commented 7 years ago

In any case, please tell me if the text linking to your implementation is correct or something should be added/removed.

nlohmann commented 7 years ago

You could link to https://github.com/nlohmann/json when mentioning the name "JSON for Modern C++" and to https://github.com/nlohmann/json#binary-formats-cbor-and-messagepack with the "Details" button.

cabo commented 7 years ago

Good idea; done.

nlohmann commented 7 years ago

Thanks a lot!