Closed THE-FYP closed 1 year ago
Interesting, I tried locally(gcc/clang) and online and it does work. What system are you using, compiler(ver)/os ? https://jsonlink.godbolt.org/z/qM3ddGc89
I'm using MSVC 19.37. I've also tested this with clang on windows and linux, gcc and mingw, no problem with these, so the issue appears to be MSVC-related.
Parsing an empty string of a class results in an error when
json_data_contract
specialization for that class has a string field and a custom nullable field in itsjson_member_list
. This is only the case when such class has an user-defined constructor. It feels like an empty string field is somehow considered anull
value under these conditions. Presence of that custom field in the data doesn't make a difference.Example to reproduce the issue:
Output: