Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
serialize (5 of 5 overloads)

Return a string representing a serialized element.

Synopsis

Defined in header <boost/json/serialize.hpp>

std::string
serialize(
    string_view t,
    serialize_options const& opts = {});
Description

This function serializes t as JSON and returns it as a std::string.

Complexity

Constant or linear in the size of t.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

The serialized string

Parameters

Name

Description

t

The value to serialize

opts

The options for the serializer. If this parameter is omitted, the serializer will output only standard JSON.

Convenience header <boost/json.hpp>


PrevUpHomeNext