Skip to content

1.12.4 version Json set enum value failed #4341

@xzzh999

Description

@xzzh999

Describe the bug

Poco::JSON::Object::Ptr obj = new Poco::JSON::Object();

// set some enum value
obj->set("taskType", SOME_ENUM_VALUE);

Poco::Dynamic::Var var(obj);
std::string result = var.convert<std::string>();

got exception:

poco got exception: Can not convert to std::string

if changed to this:

obj->set("taskType", int(SOME_ENUM_VALUE));

it works fine.

To Reproduce
always failed

Expected behavior
json convert ok

Logs
poco got exception: Can not convert to std::string

Please add relevant environment information:

  • Win 10 x64 19044.3693
  • 1.12.4

Additional context
none

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions