ark::serialization::JsonBlob

Defined in header “ark/serialization/json_blob.hh”.


This class represents a container for a JSON object. We don’t directly pass the nlohmann objects around because pulling in that headers adds 2-3+ seconds onto compilation.

Methods

  • JsonBlob(std::shared_ptr< nlohmann::json > json)
    Constructor. Wraps the json object for convenience.

  • JsonBlob(const std::string & json)
    Constructor. Initializes this blob from a string.

  • JsonBlob(const std::string_view & json)
    Constructor. Initializes this blob from a string view.

  • JsonBlob(const char *const json)
    Constructor. Initializes this blob from a pointer to characters.

  • JsonBlob(const nlohmann::json & json)
    Constructor. Wraps the json object for convenience.

  • std::string str(int32_t indent)
    Dumps a string-view of the JSON. Pass zero for no indention, or -1 for the most compact-possible representation.

  • const nlohmann::json & json()
    Returns a reference to the raw JSON data.