Deserializer.hpp

This File On Github
Ask A Question

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

Deserializer

Json Deserializer. Deserialize oatpp DTO object from json. See Data Transfer Object(DTO) component.

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

Fields

Type Name Summary
v_int32 ERROR_CODE_OBJECT_SCOPE_OPEN "'{' - expected"
v_int32 ERROR_CODE_OBJECT_SCOPE_CLOSE "'}' - expected"
v_int32 ERROR_CODE_OBJECT_SCOPE_UNKNOWN_FIELD "Unknown field"
v_int32 ERROR_CODE_OBJECT_SCOPE_COLON_MISSING "':' - expected"
v_int32 ERROR_CODE_ARRAY_SCOPE_OPEN "'[' - expected"
v_int32 ERROR_CODE_ARRAY_SCOPE_CLOSE "']' - expected"
v_int32 ERROR_CODE_VALUE_BOOLEAN "'true' or 'false' - expected"

Methods

Return Type Name Summary
[none] Deserializer Constructor.
void setDeserializerMethod Set deserializer method for type.
AbstractObjectWrapper deserialize Deserialize text.
const std::shared_ptr<Config>& getConfig Get deserializer config.

Deserializer::ERROR_CODE_OBJECT_SCOPE_OPEN

"'{' - expected"

static constexpr v_int32 ERROR_CODE_OBJECT_SCOPE_OPEN = 1

Deserializer::ERROR_CODE_OBJECT_SCOPE_CLOSE

"'}' - expected"

static constexpr v_int32 ERROR_CODE_OBJECT_SCOPE_CLOSE = 2

Deserializer::ERROR_CODE_OBJECT_SCOPE_UNKNOWN_FIELD

"Unknown field"

static constexpr v_int32 ERROR_CODE_OBJECT_SCOPE_UNKNOWN_FIELD = 3

Deserializer::ERROR_CODE_OBJECT_SCOPE_COLON_MISSING

"':' - expected"

static constexpr v_int32 ERROR_CODE_OBJECT_SCOPE_COLON_MISSING = 4

Deserializer::ERROR_CODE_ARRAY_SCOPE_OPEN

"'[' - expected"

static constexpr v_int32 ERROR_CODE_ARRAY_SCOPE_OPEN = 5

Deserializer::ERROR_CODE_ARRAY_SCOPE_CLOSE

"']' - expected"

static constexpr v_int32 ERROR_CODE_ARRAY_SCOPE_CLOSE = 6

Deserializer::ERROR_CODE_VALUE_BOOLEAN

"'true' or 'false' - expected"

static constexpr v_int32 ERROR_CODE_VALUE_BOOLEAN = 7

Deserializer::Deserializer

Constructor.

  • @param config

Deserializer(const std::shared_ptr<Config>& config = std::make_shared<Config>())

Deserializer::setDeserializerMethod

Set deserializer method for type.

void setDeserializerMethod(const data::mapping::type::ClassId& classId, DeserializerMethod method)

Deserializer::deserialize

Deserialize text.

AbstractObjectWrapper deserialize(parser::Caret& caret, const Type* const type)

Deserializer::getConfig

Get deserializer config.

  • @return

const std::shared_ptr<Config>& getConfig()

Deserializer::Config

Deserializer config.

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

Fields

Type Name Summary
bool allowUnknownFields Do not fail if unknown field is found in json. "unknown field" is the one which is not present in DTO object class.

Methods

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

Deserializer::Config::allowUnknownFields

Do not fail if unknown field is found in json. "unknown field" is the one which is not present in DTO object class.

bool allowUnknownFields = true

Deserializer::Config::Config

Constructor.

Config()

Deserializer::Config::createShared

Create shared Config.

  • @return - std::shared_ptr to Config.

static std::shared_ptr<Config> createShared()