#define JSON_NOEXCEPTION
Exceptions can be switched off by defining the symbol JSON_NOEXCEPTION. When defining JSON_NOEXCEPTION, try is replaced by if (true), catch is replaced by if (false), and throw is replaced by std::abort().
The same effect is achieved by setting the compiler flag -fno-exceptions.
By default, the macro is not defined.
#undef JSON_NOEXCEPTION
The explanatory what() string of exceptions is not available for MSVC if exceptions are disabled, see #2824.
Example
The code below switches off exceptions in the library.
#define JSON_NOEXCEPTION 1 #include <nlohmann/json.hpp> ...
Added in version 2.1.0.