Skip to content

from_json not working for boost::optional example #718

@popizdeh

Description

@popizdeh

I have a verbatim copy of adl_serializer for boost::optional from the documentation. Version 2.1.1 of the library.

nlohmann::json json{{"test", nullptr}};

boost::optional<int> works = json["test"];

boost::optional<int> broken;
broken = json["test"];

Assignment to 'broken' variable won't go through the adl_serializer and will throw std::domain_error: type must be number, but is null

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions