Verwenden von Müsli, um eine JSON -Saite in eine Struktur zu deserialisierenC++

Programme in C++. Entwicklerforum
Anonymous
 Verwenden von Müsli, um eine JSON -Saite in eine Struktur zu deserialisieren

Post by Anonymous »

Ich benutze das Bibliotheksflocken für die C ++ - Serialisierung. Die Bibliothek wird hier gefunden (https://uscilab.github.io/cereal/index.html).
Ich versuche, einen Top -Level -JSON ohne Hüllkurder zu deserialisieren.#include
#include
#include
#include
#include
#include

struct Response {
std::string id;
std::optional bar;
std::optional baz;

// Define the serialize function for Cereal
template
void serialize(Archive &ar)
{
/* ar(cereal::make_nvp("id", this->id), cereal::make_nvp("bar", this->bar),
cereal::make_nvp("baz", this->baz)); */
ar(CEREAL_NVP(id), CEREAL_NVP(bar), CEREAL_NVP(baz));
}

// Display the contents of the Response object
void show() const
{
std::cout

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post