Serializer.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/parser/json/mapping/Serializer.hpp"

Serializer

Json Serializer. Serializes oatpp DTO object to json. See Data Transfer Object(DTO) component.

namespace oatpp { namespace parser { namespace json { namespace mapping { 
  class Serializer {}
}}}}

Methods

Return Type Name Summary
void serialize Serialize DTO object to stream.

Serializer::serialize

Serialize DTO object to stream.

static void serialize(const std::shared_ptr<oatpp::data::stream::ConsistentOutputStream>& stream,
                      const oatpp::data::mapping::type::AbstractObjectWrapper& polymorph,
                      const std::shared_ptr<Config>& config)

Serializer::Config

Serializer config.

namespace oatpp { namespace parser { namespace json { namespace mapping { 
  class Serializer {
    class Config : public oatpp::base::Countable {}
  };
}}}}

Fields

Type Name Summary
bool includeNullFields Include fields with value == nullptr into serialized json.
bool throwOnUnknownTypes If true - insert string "<unknown-type>" in json field value in case unknown field found. Fail if false. Known types for this serializer are:
(String, Int8, Int16, Int32, Int64, Float32, Float64, Boolean, DTOs, List, Fields).

Methods

Return Type Name Summary
[none] Config Constructor.
std::shared_ptr<Config> createShared Create shared config.

Serializer::Config::includeNullFields

Include fields with value == nullptr into serialized json.

bool includeNullFields = true

Serializer::Config::throwOnUnknownTypes

If true - insert string "<unknown-type>" in json field value in case unknown field found. Fail if false. Known types for this serializer are:
(String, Int8, Int16, Int32, Int64, Float32, Float64, Boolean, DTOs, List, Fields).

bool throwOnUnknownTypes = true

Serializer::Config::Config

Constructor.

Config()

Serializer::Config::createShared

Create shared config.

  • @return - std::shared_ptr to Config.

static std::shared_ptr<Config> createShared()