Stiffstream / json_dto

A small header-only library for converting data between json representation and c++ structs
BSD 3-Clause "New" or "Revised" License
149 stars 18 forks source link

variant type #14

Closed navono closed 3 years ago

navono commented 3 years ago

Hi.

I have a dynamic type field in json, I simply declare it with std::any type, but it cannot be compiled. Is this possible or not?

eao197 commented 3 years ago

Hi!

json_dto is C++14 library and the only C++17 (or newer) type supported is std::optional. It means that json_dto doesn't support std::variant nor std::any.

At the moment we have no plans to upgrade json_dto to C++17. But you can add support for std::any by using any method of defining user IO for json_dto: see here for examples.

navono commented 3 years ago

Thank you for response. I'll check that.