diff --git a/src/nodejs/node_osrm.cpp b/src/nodejs/node_osrm.cpp index 91fd5f4f5..34ecc6914 100644 --- a/src/nodejs/node_osrm.cpp +++ b/src/nodejs/node_osrm.cpp @@ -167,13 +167,13 @@ inline void async(const Nan::FunctionCallbackInfo &info, ParseResult(status, json_result); if (pluginParams.renderToBuffer) { - std::ostringstream buf; - osrm::util::json::render(buf, json_result); - result = buf.str(); + std::string json_string; + osrm::util::json::render(json_string, json_result); + result = std::move(json_string); } else { - result = json_result; + result = std::move(json_result); } } break;