ark::serialization::JsonBlob

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


This class represents a container for a JSON object.

Methods

  • JsonBlob(yyjson_doc * json)
    Constructor. Takes ownership of the given yyjson_document.

  • 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 * json)
    Constructor. Initializes this blob from a pointer to characters.

  • JsonBlob(const JsonBlob & other)
    Delete the copy constructor.

  • JsonBlob(JsonBlob && other)
    Define an explicit move constructor.

  • ~JsonBlob()
    Destructor, releases memory associated with the document.

  • 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.

  • std::string str_from_pointer(const std::string & pointer, int32_t indent)
    Dumps a string-view of the JSON from the given field pointer.

  • yyjson_doc * json()
    Returns a reference to the raw JSON data.

  • JsonBlob apply_json_patch(const JsonBlob & patch)
    Applies a JSON patch (corresponding to the JSON patch RFC 6902), returning a new JSON blob.

  • JsonBlob apply_json_merge_patch(const JsonBlob & patch)
    Applies a JSON merge patch (corresponding to the JSON patch RFC 7386), returning a new JSON blob.