我正在使用此代码:
const size_t bufferSize = JSON_OBJECT_SIZE(2) + 2*JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(7);
DynamicJsonBuffer jsonBuffer(bufferSize);
JsonObject& root = jsonBuffer.createObject();
JsonObject& loc = root.createNestedObject("loc");
loc["lat"] = 45.123456;
loc["lng"] = 54.654321;
我正在输出这个:
{"loc":{"lat":45.12346,"lng":54.65432}}
但是当我将值更改为字符串(" xx.xxxxxx")时,它正常工作,只给我一个字符串而不是双字符串。为什么我错过了5和1?