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 {}
}}}}

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).
bool useBeautifier Use JSON Beautifier.
oatpp::String beautifierIndent Beautifier Indent.
oatpp::String beautifierNewLine Beautifier new line.

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::useBeautifier

Use JSON Beautifier.

bool useBeautifier = false

Serializer::Config::beautifierIndent

Beautifier Indent.

oatpp::String beautifierIndent = "  "

Serializer::Config::beautifierNewLine

Beautifier new line.

oatpp::String beautifierNewLine = "

Serializer::Config::Config

Constructor.

Config()

Serializer::Config::createShared

Create shared config.

  • @return - std::shared_ptr to Config.

static std::shared_ptr<Config> createShared()