ark::serialization::JsonObjectWriter

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


Creates a new JSON document, allowing you to write out objects/arrays/values into a JSON message.

Methods

  • JsonObjectWriter make_object(const std::string_view & name)
    Creates a new object at the given key name.

  • JsonWriteOnlyArray make_array(const std::string_view & name)
    Creates a new array at the given key name.

  • JsonObjectWriter & set_value(const std::string_view & name, JsonWriteOnlyValue value)
    Creates a new value at the given key name. Returns itself to allow easier chaining of setting values.

  • JsonObjectWriter & set_value(const std::string_view & name, Type type)
    Sets a new value by allocating from the document writer that owns this object writer.

  • JsonObjectWriter get_object(const std::string & name)
    Gets a nested object with the given name. Throws if no such key exists.

  • JsonWriteOnlyValue value()
    Returns the object as a mutable value.