jsoncons icon indicating copy to clipboard operation
jsoncons copied to clipboard

Need more debug output for datatype mismatch

Open chilarai opened this issue 4 years ago • 2 comments

I am using the json.hpp file with Qt5 & C++ 11 to process and create json files. Qt5 by default uses QString instead of std::string. Hence, while creating json, QString always has to be converted to std::string as an input to the json type of input like

QString str("teststring");
json j;
j["somevar"] = str.toStdString();

The problem is even if the str variable is not converted to stdString, the library doesn't show any semantic warning on the editor while writing the code. It is only during the compilation time, it throws an error. This makes it very hard to debug at the points where the conversion is required while writing.

Also, the compilation error only points to the file jsoncons/json_type_traits.hpp and to this block static_assert(unimplemented<T>::value, "to_json not implemented"); without specifying the lines where the conversion issue happened.

Request Can you add a feature to throw semantic warnings on the editor when there is a data mismatch?

chilarai avatar Mar 21 '21 13:03 chilarai

What operating system, compiler, and editor do you use?

danielaparker avatar Mar 21 '21 14:03 danielaparker

I am using Qt Creator on Windows 10 x64 (with MSVC 2019) and Mac (with Clang). The warnings generally appear when I use other libraries/plugins like duckdb

chilarai avatar Mar 21 '21 15:03 chilarai