double val = std::numeric_limits<double>::quiet_NaN(); DBG << "val=" << val; json j = val; DBG << "j=" << j.dump(); val = j; DBG << "val=" << val; goes like this: val=nan j=null terminate called after throwing an instance of 'std::domain_error' what(): type must be number, but is null Could this not be behave nicer?
Activity
nlohmann commentedon Mar 17, 2017
With the code in the
developbranch, this works:output:
Note the
developbranch is unreleased and is subject to changes until version 3.0.0. This behavior of NaN was only introduced recently.nlohmann commentedon Mar 22, 2017
@martukas Did you try the develop branch? Could you comment on this?