Converting C++ class to JSON

前端 未结 11 951
轮回少年
轮回少年 2020-12-02 11:56

I\'d like to create a JSON string containing the instance variables of my class.

For example,

class Example {  
    std::string string;  
    std::ma         


        
11条回答
  •  执笔经年
    2020-12-02 12:29

    Have you looked at cereal (http://uscilab.github.io/cereal/) ? It has JSON archives for serializing to/from JSON using C++.

    An example with minimal overhead (from cereal) can be found here on SO: https://stackoverflow.com/a/22587527/255635

提交回复
热议问题