json2cpp icon indicating copy to clipboard operation
json2cpp copied to clipboard

Negative integer values are not handled properly

Open carneyweb opened this issue 1 year ago • 0 comments

If I have some json that looks something like:

{ "foo" : -1 }

The value of -1 gets saved in the compilable output as the 2's complement unsigned value.

The problem is at line 76 in json2cpp.cpp:

return fmt::format("std::int64_t{{{}}}", value.get<std::**uint64_t**>());

Change that to std::int64_t and everything works great.

carneyweb avatar Aug 21 '24 15:08 carneyweb