I got this error when I built my application.
/json.hpp:843:9: error: static_assert failed "could not find to_json() method in T's namespace" static_assert(sizeof(BasicJsonType) == 0
This error occurs if you try to assign an unsupported type to json, e.g.
json
MyClass foo; json j = foo;
The second line tries to find a way to convert MyClass to json and does this by searching for a to_json function in the namespace of the class (see https://github.com/nlohmann/json#arbitrary-types-conversions for more information).
MyClass
to_json
Without more context of your program, I'm afraid I cannot help more.
@SpilledMango Any news on this?
Activity
nlohmann commentedon May 5, 2017
This error occurs if you try to assign an unsupported type to
json, e.g.The second line tries to find a way to convert
MyClasstojsonand does this by searching for ato_jsonfunction in the namespace of the class (see https://github.com/nlohmann/json#arbitrary-types-conversions for more information).Without more context of your program, I'm afraid I cannot help more.
nlohmann commentedon May 5, 2017
@SpilledMango Any news on this?