diff --git a/src/node/serialization.cc b/src/node/serialization.cc index d270e72d3958..cb310eb2cda9 100644 --- a/src/node/serialization.cc +++ b/src/node/serialization.cc @@ -167,7 +167,11 @@ class JSONAttrGetter : public AttrVisitor { ReflectionVTable* reflection_ = ReflectionVTable::Global(); void Visit(const char* key, double* value) final { - node_->attrs[key] = std::to_string(*value); + std::ostringstream s; + // Type have approximately 16 decimal digits + s.precision(16); + s << (*value); + node_->attrs[key] = s.str(); } void Visit(const char* key, int64_t* value) final { node_->attrs[key] = std::to_string(*value);