AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::json::JsonFormat Struct Reference

JSON format: serialization and deserialization of values with options. More...

#include <format.hpp>

Collaboration diagram for anch::json::JsonFormat:

Public Types

using Options = anch::json::MappingOptions

Static Public Member Functions

static const Options & defaultOptions () noexcept
template<anch::json::Mappable T>
static void serialize (const T &value, std::ostream &out, const Options &options)
template<anch::json::Mappable T>
static void deserialize (T &value, std::istream &input, const Options &options)

Static Public Attributes

static constexpr std::string_view MEDIA_TYPE = "application/json"

Detailed Description

JSON format: serialization and deserialization of values with options.

It is the format type used by generic codecs ( anch::codec::FormatCodec , anch-codec): it does not depend on them (its members follow the anch::codec::DataFormat concept).

Author
Vincent Lachenal
Since
0.3

Member Typedef Documentation

◆ Options

Member Function Documentation

◆ defaultOptions()

const JsonFormat::Options & anch::json::JsonFormat::defaultOptions ( )
inlinestaticnoexcept

Default options

Returns
anch::json::DEFAULT_MAPPING_OPTIONS

◆ deserialize()

template<anch::json::Mappable T>
void anch::json::JsonFormat::deserialize ( T & value,
std::istream & input,
const Options & options )
static

Deserialize value

Parameters
valuethe value to fill
inputthe input stream
optionsthe options
Exceptions
anch::json::MappingErroron invalid JSON or constraint violation
Here is the call graph for this function:

◆ serialize()

template<anch::json::Mappable T>
void anch::json::JsonFormat::serialize ( const T & value,
std::ostream & out,
const Options & options )
static

Serialize value

Parameters
valuethe value (described object, collection, map, primitive, ...)
outthe output stream
optionsthe options
Exceptions
anch::json::MappingErroron constraint violation (when constraints are checked on serialization)
Here is the call graph for this function:

Member Data Documentation

◆ MEDIA_TYPE

std::string_view anch::json::JsonFormat::MEDIA_TYPE = "application/json"
staticconstexpr

Media type


The documentation for this struct was generated from the following file: